1
0
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:
Frederik Bosch
2015-08-11 11:51:06 +02:00
parent c0c0b4bee3
commit 8b2df20b95

View File

@@ -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);
}
}