mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-05 07:45:39 +08:00
add micro php version limit
This commit is contained in:
@@ -219,6 +219,9 @@ class MacOSBuilder extends BuilderBase
|
||||
*/
|
||||
public function buildMicro(string $extra_libs): void
|
||||
{
|
||||
if ($this->getPHPVersionID() < 80000) {
|
||||
throw new RuntimeException('phpmicro only support PHP >= 8.0!');
|
||||
}
|
||||
if ($this->getExt('phar')) {
|
||||
$this->phar_patched = true;
|
||||
try {
|
||||
@@ -260,4 +263,11 @@ class MacOSBuilder extends BuilderBase
|
||||
'strip sapi/cli/php'
|
||||
);
|
||||
}
|
||||
|
||||
public function getPHPVersionID(): int
|
||||
{
|
||||
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
|
||||
preg_match('/PHP_VERSION_ID (\d+)/', $file, $match);
|
||||
return intval($match[1]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,8 +77,8 @@ class BuildCliCommand extends BuildCommand
|
||||
if ($input->getOption('debug')) {
|
||||
ExceptionHandler::getInstance()->handle($e);
|
||||
} else {
|
||||
logger()->emergency('Build failed, please check terminal output, or build with --debug option to see more details.');
|
||||
logger()->emergency($e->getMessage());
|
||||
logger()->critical('Build failed, please check terminal output, or build with --debug option to see more details.');
|
||||
logger()->critical($e->getMessage());
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user