22
33require_once __DIR__ . '/shared.php ' ;
44
5- foreach (array ("mbstring " , "sockets " , "mysqli " , "openssl " ) as $ ext ) {
6- if (!extension_loaded ($ ext )) {
7- throw new LogicException ("Extension $ ext is required. " );
8- }
9- }
10-
115$ storeResult = ($ argv [1 ] ?? 'false ' ) === 'true ' ;
126$ phpCgi = $ argv [2 ] ?? dirname (PHP_BINARY ) . '/php-cgi ' ;
137if (!file_exists ($ phpCgi )) {
@@ -27,12 +21,18 @@ function main() {
2721 if (false !== $ branch = getenv ('GITHUB_REF_NAME ' )) {
2822 $ data ['branch ' ] = $ branch ;
2923 }
24+
3025 $ data ['Zend/bench.php ' ] = runBench (false );
3126 $ data ['Zend/bench.php JIT ' ] = runBench (true );
27+
28+ checkExtensions (['mbstring ' ]);
3229 $ data ['Symfony Demo 2.2.3 ' ] = runSymfonyDemo (false );
3330 $ data ['Symfony Demo 2.2.3 JIT ' ] = runSymfonyDemo (true );
31+
32+ checkExtensions (['mbstring ' , 'sockets ' , 'mysqli ' , 'openssl ' ]);
3433 $ data ['Wordpress 6.2 ' ] = runWordpress (false );
3534 $ data ['Wordpress 6.2 JIT ' ] = runWordpress (true );
35+
3636 $ result = json_encode ($ data , JSON_PRETTY_PRINT ) . "\n" ;
3737
3838 fwrite (STDOUT , $ result );
@@ -42,6 +42,14 @@ function main() {
4242 }
4343}
4444
45+ function checkExtensions (array $ extensions ): void {
46+ foreach ($ extensions as $ ext ) {
47+ if (!extension_loaded ($ ext )) {
48+ throw new LogicException ("Extension $ ext is required. " );
49+ }
50+ }
51+ }
52+
4553function storeResult (string $ result ) {
4654 $ repo = __DIR__ . '/repos/data ' ;
4755 cloneRepo ($ repo , 'git@github.com:php/benchmarking-data.git ' );
0 commit comments