Skip to content

Commit

Permalink
🚨 Fix strpos() deprecation notice with null (#11310)
Browse files Browse the repository at this point in the history
Deprecation Notice: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in composer/src/Composer/DependencyResolver/SolverProblemsException.php:80
  • Loading branch information
homersimpsons committed Feb 10, 2023
1 parent 9c86ff9 commit 1997bb8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Composer/DependencyResolver/SolverProblemsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ private function hasExtensionProblems(array $reasonSets)
{
foreach ($reasonSets as $reasonSet) {
foreach ($reasonSet as $reason) {
if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
return true;
if (isset($reason["rule"])) {
$requiredPackage = $reason["rule"]->getRequiredPackage();
if ($requiredPackage !== null && 0 === strpos($requiredPackage, 'ext-')) {
return true;
}
}
}
}
Expand Down

0 comments on commit 1997bb8

Please sign in to comment.