add micro php version limit

This commit is contained in:
crazywhalecc
2023-03-18 20:08:54 +08:00
parent 4edd05f4df
commit 9ce92e39d5
5 changed files with 15 additions and 5 deletions

View File

@@ -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]);
}
}

View File

@@ -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;
}