mirror of
https://github.com/php/pie.git
synced 2026-03-23 23:12:17 +01:00
436: detect if PHP is in Debug mode
This commit is contained in:
@@ -27,7 +27,7 @@ final class PrePackagedBinaryAssetName
|
||||
$targetPlatform->phpBinaryPath->majorMinorVersion(),
|
||||
$targetPlatform->architecture->name,
|
||||
$targetPlatform->libcFlavour()->value,
|
||||
DebugBuild::Debug->value, // @todo 436 - detect debug mode
|
||||
$targetPlatform->phpBinaryPath->debugMode()->value,
|
||||
$targetPlatform->threadSafety->asShort(),
|
||||
)),
|
||||
];
|
||||
|
||||
@@ -9,6 +9,7 @@ use Composer\Semver\VersionParser;
|
||||
use Composer\Util\Platform;
|
||||
use Php\Pie\ExtensionName;
|
||||
use Php\Pie\Platform\Architecture;
|
||||
use Php\Pie\Platform\DebugBuild;
|
||||
use Php\Pie\Platform\OperatingSystem;
|
||||
use Php\Pie\Platform\OperatingSystemFamily;
|
||||
use Php\Pie\Util\Process;
|
||||
@@ -89,6 +90,18 @@ class PhpBinaryPath
|
||||
throw new RuntimeException('Failed to find PHP API version...');
|
||||
}
|
||||
|
||||
public function debugMode(): DebugBuild
|
||||
{
|
||||
if (
|
||||
preg_match('/Debug Build([ =>\t]*)(.*)/', $this->phpinfo(), $m)
|
||||
&& $m[2] !== ''
|
||||
) {
|
||||
return $m[2] === 'yes' ? DebugBuild::Debug : DebugBuild::NoDebug;
|
||||
}
|
||||
|
||||
throw new RuntimeException('Failed to find PHP API version...');
|
||||
}
|
||||
|
||||
/** @return non-empty-string */
|
||||
public function extensionPath(): string
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user