Skip to content

Commit

Permalink
Fixed deprecation warning when parsing parameters in ShellDispatcher.php
Browse files Browse the repository at this point in the history
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
  • Loading branch information
daris committed Sep 18, 2023
1 parent b0200a7 commit 7c8934a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Cake/Console/ShellDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public function parseParams($args) {
$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;
}
Expand Down

0 comments on commit 7c8934a

Please sign in to comment.