File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 2424
2525 // Extract enterpriseVersion from the config file by parsing it
2626 $ configContent = file_get_contents (__DIR__ . '/config/config.php ' );
27- preg_match ('/\$enterpriseVersion\s*=\s*[ \'"]([^ \'"]+)[ \'"]/ ' , $ configContent , $ matches );
27+ if ($ configContent === false ) {
28+ http_response_code (500 );
29+ echo json_encode (['error ' => 'Failed to read configuration file ' ], JSON_THROW_ON_ERROR );
30+ exit ();
31+ }
32+
33+ preg_match ('/\$enterpriseVersion\s*=\s*[ \'"]([^ \'"\r\n]+)[ \'"]/ ' , $ configContent , $ matches );
2834 $ enterpriseVersion = isset ($ matches [1 ]) ? $ matches [1 ] : null ;
2935
30- echo json_encode (['enterpriseVersion ' => $ enterpriseVersion ]);
36+ echo json_encode (['enterpriseVersion ' => $ enterpriseVersion ], JSON_THROW_ON_ERROR );
3137 exit ();
3238}
3339
You can’t perform that action at this time.
0 commit comments