mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-05 04:37:38 +02:00
FIX IntrospectionProcessor: E_NOTICE
Recent merge of #608 misses check whether the trace exists at all at the specific index, leading to undefined offset. ``` E_NOTICE: Undefined offset: 3 ``` And because the while statement became unreadable (and too long), I moved it into a separate method.
This commit is contained in:
@@ -61,7 +61,7 @@ class IntrospectionProcessor
|
||||
|
||||
$i = 0;
|
||||
|
||||
while (isset($trace[$i]['class']) || in_array($trace[$i]['function'], $this->skipFunctions)) {
|
||||
while ($this->isTraceClassOrNotSkippedFunction($trace, $i)) {
|
||||
if (isset($trace[$i]['class'])) {
|
||||
foreach ($this->skipClassesPartials as $part) {
|
||||
if (strpos($trace[$i]['class'], $part) !== false) {
|
||||
@@ -90,4 +90,13 @@ class IntrospectionProcessor
|
||||
|
||||
return $record;
|
||||
}
|
||||
|
||||
private function isTraceClassOrNotSkippedFunction ($trace, $index)
|
||||
{
|
||||
if (isset($trace[$index]) === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset($trace[$index]['class']) || in_array($trace[$index]['function'], $this->skipFunctions);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user