mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Add PHP_BUILD_PROVIDER for PHP >= 8.4
This commit is contained in:
parent
7d0577460f
commit
9487051796
@ -588,13 +588,18 @@ class SourcePatcher
|
|||||||
*/
|
*/
|
||||||
public static function patchSPCVersionToPHP(string $version = 'unknown'): void
|
public static function patchSPCVersionToPHP(string $version = 'unknown'): void
|
||||||
{
|
{
|
||||||
// detect patch
|
// detect patch (remove this when 8.3 deprecated)
|
||||||
$file = FileSystem::readFile(SOURCE_PATH . '/php-src/main/main.c');
|
$file = FileSystem::readFile(SOURCE_PATH . '/php-src/main/main.c');
|
||||||
if (!str_contains($file, 'static-php-cli.version')) {
|
if (!str_contains($file, 'static-php-cli.version')) {
|
||||||
logger()->debug('Inserting static-php-cli.version to php-src');
|
logger()->debug('Inserting static-php-cli.version to php-src');
|
||||||
$file = str_replace('PHP_INI_BEGIN()', "PHP_INI_BEGIN()\n\tPHP_INI_ENTRY(\"static-php-cli.version\",\t\"{$version}\",\tPHP_INI_ALL,\tNULL)", $file);
|
$file = str_replace('PHP_INI_BEGIN()', "PHP_INI_BEGIN()\n\tPHP_INI_ENTRY(\"static-php-cli.version\",\t\"{$version}\",\tPHP_INI_ALL,\tNULL)", $file);
|
||||||
FileSystem::writeFile(SOURCE_PATH . '/php-src/main/main.c', $file);
|
FileSystem::writeFile(SOURCE_PATH . '/php-src/main/main.c', $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add PHP_BUILD_PROVIDER
|
||||||
|
if (getenv('PHP_BUILD_PROVIDER') === false) {
|
||||||
|
putenv("PHP_BUILD_PROVIDER=static-php-cli {$version}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user