N°9675 - geptile PR fixes + enhance regexp for cli php version

This commit is contained in:
odain
2026-07-01 17:51:13 +02:00
parent e27dcbfb2d
commit 7a70e2460a
3 changed files with 17 additions and 6 deletions

View File

@@ -5774,6 +5774,9 @@ abstract class MetaModel
}
if ($bModelOnly) {
// Event service must be initialized after the MetaModel startup, otherwise it cannot discover classes implementing the iEventServiceSetup interface
EventService::InitService();
EventService::FireEvent(new EventData(ApplicationEvents::APPLICATION_EVENT_METAMODEL_STARTED));
return;
}
}

View File

@@ -93,7 +93,7 @@ class ModelReflectionSerializer
public function CheckCliPhpVersionFromOutput(string $sUIPhpVersion, string $sPHPExec, $aOutput): void
{
$sFoundVersion = trim($aOutput[0] ?? "");
if (preg_match('/^.* (\d\.\d)\.\d/', $sFoundVersion, $aMatches)) {
if (preg_match('/(\d+\.\d+)(?:\.\d+)?/', $sFoundVersion, $aMatches)) {
$sFoundVersion = $aMatches[1];
}
if ($sFoundVersion != $sUIPhpVersion) {

View File

@@ -32,12 +32,20 @@ OUTPUT;
ModelReflectionSerializer::GetInstance()->CheckCliPhpVersionFromOutput('6.6', 'sPHPExec', [$sOuput]);
}
public function testCheckOK()
public function CheckOKProvider()
{
return [
["7.4 7.2 7.3.33"],
["PHP 7.4.33 (cli) (built: Aug 2 2024 16:22:28) ( NTS )"],
["PHP 7.4.33 PHP 7.33.22"],
["version: 7.4.27 stable"],
];
}
/**
* @dataProvider CheckOKProvider
*/
public function testCheckOK($sOuput)
{
$sOuput = <<<OUTPUT
PHP 7.4.33 (cli) (built: Aug 2 2024 16:22:28) ( NTS )
OUTPUT;
ModelReflectionSerializer::GetInstance()->CheckCliPhpVersionFromOutput('7.4', 'sPHPExec', [$sOuput]);
$this->assertTrue(true);
}