Suppress warnings when open_basedir is non-empty

If PHP is configured *with a non-empty open_basedir* value that does not permit access to the target location, these calls to is_executable() throw warnings.

While Symfony may not raise exceptions for warnings in production environments, other frameworks (such as Laravel) do, in which case any of these checks causes a show-stopping 500 error.

We fixed a similar issue in the ExecutableFinder class via symfony/symfony#16182 .

This has always been an issue, but 709e15e7a37cb7ed6199548dc70dc33168e6cb2d made it more likely that a warning is triggered.
This commit is contained in:
Ben Johnson 2018-05-03 12:50:56 -04:00 committed by GitHub
parent ffb07c6a99
commit 34f136e01b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,7 @@ class PhpExecutableFinder
}
if ($php = getenv('PHP_PATH')) {
if (!is_executable($php)) {
if (@!is_executable($php)) {
return false;
}
@ -57,12 +57,12 @@ class PhpExecutableFinder
}
if ($php = getenv('PHP_PEAR_PHP_BIN')) {
if (is_executable($php)) {
if (@is_executable($php)) {
return $php;
}
}
if (is_executable($php = PHP_BINDIR.('\\' === DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
if (@is_executable($php = PHP_BINDIR.('\\' === DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
return $php;
}