10000 bug #54298 [Filesystem] Fix str_contains deprecation (NeilPeyssard) · symfony/symfony@e05d922 · GitHub
[go: up one dir, main page]

Skip to content

Commit e05d922

Browse files
committed
bug #54298 [Filesystem] Fix str_contains deprecation (NeilPeyssard)
This PR was merged into the 5.4 branch. Discussion ---------- [Filesystem] Fix str_contains deprecation | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #54291 | License | MIT In the Filesystem component, `str_contains` is potentially called with null as a first parameter. This is deprecated since PHP 8.1. Commits ------- d7519b7 [Filesystem] Fix str_contains deprecation
2 parents 3fbca7b + d7519b7 commit e05d922

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private static function doRemove(array $files, bool $isRecursive): void
199199

200200
throw new IOException(sprintf('Failed to remove directory "%s": ', $file).$lastError);
201201
}
202-
} elseif (!self::box('unlink', $file) && (str_contains(self::$lastError, 'Permission denied') || file_exists($file))) {
202+
} elseif (!self::box('unlink', $file) && ((self::$lastError && str_contains(self::$lastError, 'Permission denied')) || file_exists($file))) {
203203
throw new IOException(sprintf('Failed to remove file "%s": ', $file).self::$lastError);
204204
}
205205
}

0 commit comments

Comments
 (0)
0