Commit 7f1f3b8b authored by xjm's avatar xjm

Issue #3026386 by dsnopek, samuel.mortenson, xjm, ydahi, alexpott, Fabianx,...

Issue #3026386 by dsnopek, samuel.mortenson, xjm, ydahi, alexpott, Fabianx, kferencz91, littlepixiez, greggles, cilefen: Drush fatal error after upgrading to 8.6.6, 8.5.9, or 7.62: PHP Fatal error:  Uncaught TYPO3PharStreamWrapperException
parent 492fd4da
......@@ -22,7 +22,6 @@ class PharExtensionInterceptor implements Assertable {
*
* @param string $path
* The path of the phar file to check.
*
* @param string $command
* The command being carried out.
*
......@@ -46,6 +45,8 @@ public function assert($path, $command) {
}
/**
* Determines if a path has a .phar extension or invoked execution.
*
* @param string $path
* The path of the phar file to check.
*
......@@ -62,8 +63,13 @@ private function baseFileContainsPharExtension($path) {
// not not have .phar extension then this should be allowed. For
// example, some CLI tools recommend removing the extension.
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
$caller = array_pop($backtrace);
if (isset($caller['file']) && $baseFile === $caller['file']) {
// Find the last entry in the backtrace containing a 'file' key as
// sometimes the last caller is executed outside the scope of a file. For
// example, this occurs with shutdown functions.
do {
$caller = array_pop($backtrace);
} while (empty($caller['file']) && !empty($backtrace));
if (isset($caller['file']) && $baseFile === Helper::determineBaseFile($caller['file'])) {
return TRUE;
}
$fileExtension = pathinfo($baseFile, PATHINFO_EXTENSION);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment