From 7a70e2460adfb01cb698daed009d289581b0cb42 Mon Sep 17 00:00:00 2001 From: odain Date: Wed, 1 Jul 2026 17:51:13 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B09675=20-=20geptile=20PR=20fixes=20+=20en?= =?UTF-8?q?hance=20regexp=20for=20cli=20php=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/metamodel.class.php | 3 +++ .../ModelReflectionSerializer.php | 2 +- .../feature_removal/ModelSerializationTest.php | 18 +++++++++++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/core/metamodel.class.php b/core/metamodel.class.php index ad6a97cbfc..ddc9dcb322 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -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; } } diff --git a/setup/feature_removal/ModelReflectionSerializer.php b/setup/feature_removal/ModelReflectionSerializer.php index bca18bb1b9..9fcdffb58e 100644 --- a/setup/feature_removal/ModelReflectionSerializer.php +++ b/setup/feature_removal/ModelReflectionSerializer.php @@ -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) { diff --git a/tests/php-unit-tests/unitary-tests/setup/feature_removal/ModelSerializationTest.php b/tests/php-unit-tests/unitary-tests/setup/feature_removal/ModelSerializationTest.php index dfd1616556..85ced1e0c4 100644 --- a/tests/php-unit-tests/unitary-tests/setup/feature_removal/ModelSerializationTest.php +++ b/tests/php-unit-tests/unitary-tests/setup/feature_removal/ModelSerializationTest.php @@ -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 = <<CheckCliPhpVersionFromOutput('7.4', 'sPHPExec', [$sOuput]); $this->assertTrue(true); }