bug #37526 [Cache][Config] ensure compatibility with PHP 8 stack traces (xabbuh)
This PR was merged into the 3.4 branch.
Discussion
----------
[Cache][Config] ensure compatibility with PHP 8 stack traces
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Commits
-------
8ba34dafd3
ensure compatibility with PHP 8 stack traces
This commit is contained in:
commit
207b0b5996
@ -275,10 +275,17 @@ class PhpArrayAdapter implements AdapterInterface, PruneableInterface, Resettabl
|
||||
'function' => 'spl_autoload_call',
|
||||
'args' => [$class],
|
||||
];
|
||||
$i = 1 + array_search($autoloadFrame, $trace, true);
|
||||
|
||||
if (isset($trace[$i]['function']) && !isset($trace[$i]['class'])) {
|
||||
switch ($trace[$i]['function']) {
|
||||
if (\PHP_VERSION_ID >= 80000 && isset($trace[1])) {
|
||||
$callerFrame = $trace[1];
|
||||
} elseif (false !== $i = array_search($autoloadFrame, $trace, true)) {
|
||||
$callerFrame = $trace[++$i];
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if (isset($callerFrame['function']) && !isset($callerFrame['class'])) {
|
||||
switch ($callerFrame['function']) {
|
||||
case 'get_class_methods':
|
||||
case 'get_class_vars':
|
||||
case 'get_parent_class':
|
||||
|
@ -190,12 +190,17 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
|
||||
'args' => [$class],
|
||||
];
|
||||
|
||||
if (false === $i = array_search($autoloadFrame, $trace, true)) {
|
||||
if (\PHP_VERSION_ID >= 80000 && isset($trace[1])) {
|
||||
$callerFrame = $trace[1];
|
||||
$i = 2;
|
||||
} elseif (false !== $i = array_search($autoloadFrame, $trace, true)) {
|
||||
$callerFrame = $trace[++$i];
|
||||
} else {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if (isset($trace[++$i]['function']) && !isset($trace[$i]['class'])) {
|
||||
switch ($trace[$i]['function']) {
|
||||
if (isset($callerFrame['function']) && !isset($callerFrame['class'])) {
|
||||
switch ($callerFrame['function']) {
|
||||
case 'get_class_methods':
|
||||
case 'get_class_vars':
|
||||
case 'get_parent_class':
|
||||
@ -214,8 +219,8 @@ class ClassExistenceResource implements SelfCheckingResourceInterface, \Serializ
|
||||
}
|
||||
|
||||
$props = [
|
||||
'file' => isset($trace[$i]['file']) ? $trace[$i]['file'] : null,
|
||||
'line' => isset($trace[$i]['line']) ? $trace[$i]['line'] : null,
|
||||
'file' => isset($callerFrame['file']) ? $callerFrame['file'] : null,
|
||||
'line' => isset($callerFrame['line']) ? $callerFrame['line'] : null,
|
||||
'trace' => \array_slice($trace, 1 + $i),
|
||||
];
|
||||
|
||||
|
Reference in New Issue
Block a user