|
4 | 4 | * See COPYING.txt for license details. |
5 | 5 | */ |
6 | 6 |
|
| 7 | +/** |
| 8 | + * phpcs:disable PSR1.Files.SideEffects |
| 9 | + * phpcs:disable Squiz.Functions.GlobalFunction |
| 10 | + */ |
7 | 11 | use Magento\Framework\Config\ConfigOptionsListConstants; |
8 | 12 |
|
| 13 | +// phpcs:ignore Magento2.Functions.DiscouragedFunction |
9 | 14 | register_shutdown_function("fatalErrorHandler"); |
10 | 15 |
|
11 | 16 | try { |
| 17 | + // phpcs:ignore Magento2.Security.IncludeFile |
12 | 18 | require __DIR__ . '/../app/bootstrap.php'; |
13 | 19 | /** @var \Magento\Framework\App\ObjectManagerFactory $objectManagerFactory */ |
14 | 20 | $objectManagerFactory = \Magento\Framework\App\Bootstrap::createObjectManagerFactory(BP, []); |
|
20 | 26 | $logger = $objectManager->get(\Psr\Log\LoggerInterface::class); |
21 | 27 | } catch (\Exception $e) { |
22 | 28 | http_response_code(500); |
| 29 | + // phpcs:ignore Magento2.Security.LanguageConstruct |
23 | 30 | exit(1); |
24 | 31 | } |
25 | 32 |
|
|
35 | 42 | } catch (\Exception $e) { |
36 | 43 | http_response_code(500); |
37 | 44 | $logger->error("MySQL connection failed: " . $e->getMessage()); |
| 45 | + // phpcs:ignore Magento2.Security.LanguageConstruct |
38 | 46 | exit(1); |
39 | 47 | } |
40 | 48 | } |
|
47 | 55 | !isset($cacheConfig[ConfigOptionsListConstants::CONFIG_PATH_BACKEND_OPTIONS])) { |
48 | 56 | http_response_code(500); |
49 | 57 | $logger->error("Cache configuration is invalid"); |
| 58 | + // phpcs:ignore Magento2.Security.LanguageConstruct |
50 | 59 | exit(1); |
51 | 60 | } |
52 | 61 | $cacheBackendClass = $cacheConfig[ConfigOptionsListConstants::CONFIG_PATH_BACKEND]; |
|
57 | 66 | } catch (\Exception $e) { |
58 | 67 | http_response_code(500); |
59 | 68 | $logger->error("Cache storage is not accessible"); |
| 69 | + // phpcs:ignore Magento2.Security.LanguageConstruct |
60 | 70 | exit(1); |
61 | 71 | } |
62 | 72 | } |
|
70 | 80 | function fatalErrorHandler() |
71 | 81 | { |
72 | 82 | $error = error_get_last(); |
73 | | - if ($error !== null) { |
| 83 | + if ($error !== null && $error['type'] === E_ERROR) { |
74 | 84 | http_response_code(500); |
75 | 85 | } |
76 | 86 | } |
0 commit comments