8000 bug #27141 [Process] Suppress warnings when open_basedir is non-empty… · symfony/symfony@b7feafc · GitHub
[go: up one dir, main page]

Skip to content

Commit b7feafc

Browse files
bug #27141 [Process] Suppress warnings when open_basedir is non-empty (cbj4074)
This PR was merged into the 2.7 branch. Discussion ---------- [Process] Suppress warnings when open_basedir is non-empty | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | 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 #16182 . This has always been an issue, but symfony/process@709e15e made it more likely that a warning is triggered. Commits ------- 34f136e Suppress warnings when open_basedir is non-empty
2 parents 974050f + 34f136e commit b7feafc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/Symfony/Component/Process/ExecutableFinder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function find($name, $default = null, array $extraDirs = array())
7777
}
7878
foreach ($suffixes as $suffix) {
7979
foreach ($dirs as $dir) {
80-
if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) {
80+
if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || @is_executable($file))) {
8181
return $file;
8282
}
8383
}

src/Symfony/Component/Process/PhpExecutableFinder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@ public function find($includeArgs = true)
4949
}
5050

5151
if ($php = getenv('PHP_PATH')) {
52-
if (!is_executable($php)) {
52+
if (!@is_executable($php)) {
5353
return false;
5454
}
5555

5656
return $php;
5757
}
5858

5959
if ($php = getenv('PHP_PEAR_PHP_BIN')) {
60-
if (is_executable($php)) {
60+
if (@is_executable($php)) {
6161
return $php;
6262
}
6363
}
6464

65-
if (is_executable($php = PHP_BINDIR.('\\' === DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
65+
if (@is_executable($php = PHP_BINDIR.('\\' === DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
6666
return $php;
6767
}
6868

0 commit comments

Comments
 (0)
0