1
0
Fork 0

🚨 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
pull/11609/head
homersimpsons 2023-02-10 13:25:03 +01:00 committed by GitHub
parent 9c86ff9fff
commit 1997bb8f36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -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;
}
}
}
}