From 1997bb8f364eef2e227b66511a1358a6ed139ea8 Mon Sep 17 00:00:00 2001 From: homersimpsons Date: Fri, 10 Feb 2023 13:25:03 +0100 Subject: [PATCH] :rotating_light: Fix `strpos()` deprecation notice with `null` (#11310) Deprecation Notice: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in composer/src/Composer/DependencyResolver/SolverProblemsException.php:80 --- .../DependencyResolver/SolverProblemsException.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Composer/DependencyResolver/SolverProblemsException.php b/src/Composer/DependencyResolver/SolverProblemsException.php index a39e90ddd..7f5df6092 100644 --- a/src/Composer/DependencyResolver/SolverProblemsException.php +++ b/src/Composer/DependencyResolver/SolverProblemsException.php @@ -77,8 +77,11 @@ class SolverProblemsException extends \RuntimeException { 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; + } } } }