From 42d88187c54c4ae80468c34f1319de075a48ec75 Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk Date: Mon, 18 Apr 2022 18:47:38 +0300 Subject: [PATCH 1/4] Trigger error on PHP 8.1 Error text: Deprecated: strpos(): Passing null to parameter 1 ($haystack) of type string is deprecated in Magento/Framework/Profiler/Driver/Standard/Stat.php:213 --- .../Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php b/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php index 24fb19bfa1a4a..e4e103eb5d689 100644 --- a/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php +++ b/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php @@ -238,6 +238,10 @@ public function timersSortingDataProvider() ['start', 'root'], ['start', 'root->init'], ['start', 'root->system'], + ['start', 'root->system->init_config'], + ['stop', 'root->system->init_config'], + ['start', 'root->system->init_store'], + ['stop', 'root->system->init_store'], ['stop', 'root->system'], ['start', 'root->init->init_config'], ['stop', 'root->init->init_config'], From 061c14cd79253526b0a6139496144ee7d9c73611 Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk Date: Mon, 18 Apr 2022 18:54:16 +0300 Subject: [PATCH 2/4] Fix php error caused by previous commit --- .../Magento/Framework/Profiler/Driver/Standard/Stat.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/internal/Magento/Framework/Profiler/Driver/Standard/Stat.php b/lib/internal/Magento/Framework/Profiler/Driver/Standard/Stat.php index 9774bef8cb513..9082c585f58f7 100644 --- a/lib/internal/Magento/Framework/Profiler/Driver/Standard/Stat.php +++ b/lib/internal/Magento/Framework/Profiler/Driver/Standard/Stat.php @@ -210,6 +210,9 @@ protected function _getOrderedTimerIds() while (strpos($timerId, $prevTimerId . Profiler::NESTING_SEPARATOR) !== 0) { /* Add to result all timers nested in the previous timer */ for ($j = $i + 1; $j < count($timerIds); $j++) { + if (!$timerIds[$j]) { + continue; + } if (strpos($timerIds[$j], $prevTimerId . Profiler::NESTING_SEPARATOR) === 0) { $result[] = $timerIds[$j]; /* Mark timer as already added */ From 6cbade3f2d1d4258d2d94ab2303bcdd126938223 Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk Date: Mon, 18 Apr 2022 18:55:52 +0300 Subject: [PATCH 3/4] Fix failing test --- .../Profiler/Test/Unit/Driver/Standard/StatTest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php b/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php index e4e103eb5d689..fcf891961c14f 100644 --- a/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php +++ b/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php @@ -248,7 +248,14 @@ public function timersSortingDataProvider() ['stop', 'root->init'], ['stop', 'root'], ], - 'expected' => ['root', 'root->init', 'root->init->init_config', 'root->system'], + 'expected' => [ + 'root', + 'root->init', + 'root->init->init_config', + 'root->system', + 'root->system->init_config', + 'root->system->init_store', + ], ] ]; } From b9bdcbd8716917d735b6282de0488244e02fed63 Mon Sep 17 00:00:00 2001 From: Eugene Shakhsuvarov Date: Tue, 9 Aug 2022 13:19:25 -0500 Subject: [PATCH 4/4] Make static tests happy --- .../Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php b/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php index fcf891961c14f..20cd906f5425f 100644 --- a/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php +++ b/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php @@ -1,7 +1,5 @@