summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorxjm2019-01-16 23:30:04 (GMT)
committerxjm2019-01-16 23:30:04 (GMT)
commitb34c8b9a532e272d9d2d05ddc470d80d1500e480 (patch)
tree66b481a502b8c901a679e4bf61e149a3688fa45b /core
parent38479f1fce3ed92cbcb848816440b4f84decb7f1 (diff)
parent021b0fd5d6ac752c472655b16c68286acba8afd0 (diff)
Merged 8.6.7.
Diffstat (limited to 'core')
-rw-r--r--core/lib/Drupal/Core/Security/PharExtensionInterceptor.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/lib/Drupal/Core/Security/PharExtensionInterceptor.php b/core/lib/Drupal/Core/Security/PharExtensionInterceptor.php
index a77e9f8..2e1a0cb 100644
--- a/core/lib/Drupal/Core/Security/PharExtensionInterceptor.php
+++ b/core/lib/Drupal/Core/Security/PharExtensionInterceptor.php
@@ -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 @@ class PharExtensionInterceptor implements Assertable {
}
/**
+ * 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 @@ class PharExtensionInterceptor implements Assertable {
// 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);