From 5dbc22efd37194e8f681079f93caacf9f4f60446 Mon Sep 17 00:00:00 2001 From: daris Date: Mon, 18 Sep 2023 13:34:37 +0200 Subject: [PATCH] Fixed deprecation warning when parsing parameters in ShellDispatcher.php PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in lib/Cake/Console/ShellDispatcher.php on line 295 It broke some behat tests for my project because PHP issued warning and then session has not been able to start correctly due to "Session cannot be started after headers have already been sent" error --- lib/Cake/Console/ShellDispatcher.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Cake/Console/ShellDispatcher.php b/lib/Cake/Console/ShellDispatcher.php index 2238257b2..af3304c9a 100644 --- a/lib/Cake/Console/ShellDispatcher.php +++ b/lib/Cake/Console/ShellDispatcher.php @@ -292,7 +292,7 @@ class ShellDispatcher { $params = array_merge($defaults, array_intersect_key($this->params, $defaults)); $isWin = false; foreach ($defaults as $default => $value) { - if (strpos($params[$default], '\\') !== false) { + if (!is_null($params[$default]) && strpos($params[$default], '\\') !== false) { $isWin = true; break; }