[GH-ISSUE #1199] ErrorException: Expected array for frame 0 #498

Closed
opened 2026-03-04 02:15:29 +03:00 by kerem · 3 comments
Owner

Originally created by @andrey-helldar on GitHub (Oct 2, 2018).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1199

When the code throws out the event, in the console I see an error processing it:

ErrorException  : Expected array for frame 0

  at /home/vagrant/code/example.com/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php:144
    140|         }
    141| 
    142|         $str = '[object] ('.get_class($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')';
    143|         if ($this->includeStacktraces) {
  > 144|             $str .= "\n[stacktrace]\n".$e->getTraceAsString()."\n";
    145|         }
    146| 
    147|         return $str;
    148|     }

  Exception trace:

  1   Exception::getTraceAsString()
      /home/vagrant/code/example.com/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php:144

  2   Monolog\Formatter\LineFormatter::normalizeException(Object(ErrorException))
      /home/vagrant/code/example.com/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php:95

  Please use the argument -v to see more details.

Test code:

Artisan::command('foo:bar', function () {
    $foo = $bar;
});

Error handling of exceptions in the console occurs whenever there is no catching of exceptions.

I use Laravel Framework 5.7 with monolog/monolog package 1.23.0 version.
PHP: 7.2.9
OS: ubuntu 18.04.1 on Laravel Homestead.

Originally created by @andrey-helldar on GitHub (Oct 2, 2018). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1199 When the code throws out the event, in the console I see an error processing it: ``` ErrorException : Expected array for frame 0 at /home/vagrant/code/example.com/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php:144 140| } 141| 142| $str = '[object] ('.get_class($e).'(code: '.$e->getCode().'): '.$e->getMessage().' at '.$e->getFile().':'.$e->getLine().$previousText.')'; 143| if ($this->includeStacktraces) { > 144| $str .= "\n[stacktrace]\n".$e->getTraceAsString()."\n"; 145| } 146| 147| return $str; 148| } Exception trace: 1 Exception::getTraceAsString() /home/vagrant/code/example.com/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php:144 2 Monolog\Formatter\LineFormatter::normalizeException(Object(ErrorException)) /home/vagrant/code/example.com/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php:95 Please use the argument -v to see more details. ``` Test code: ```php Artisan::command('foo:bar', function () { $foo = $bar; }); ``` Error handling of exceptions in the console occurs whenever there is no catching of exceptions. I use Laravel Framework 5.7 with `monolog/monolog` package `1.23.0` version. PHP: `7.2.9` OS: `ubuntu 18.04.1` on Laravel Homestead.
kerem closed this issue 2026-03-04 02:15:30 +03:00
Author
Owner

@andrey-helldar commented on GitHub (Oct 5, 2018):

Probably the problem was not in the package, but in the Laravel framework. There is no such error in release 5.7.8.

<!-- gh-comment-id:427394181 --> @andrey-helldar commented on GitHub (Oct 5, 2018): Probably the problem was not in the package, but in the [Laravel framework](https://github.com/laravel/framework/releases/tag/v5.7.8). There is no such error in release [5.7.8](https://github.com/laravel/framework/releases/tag/v5.7.8).
Author
Owner

@andrey-helldar commented on GitHub (Nov 5, 2018):

The problem persists even in the most recent version of the framework - `5.7.12
2018-11-05_20-46-09
If you comment out the 146 line, then the monolog returns a real error, not its own.

<!-- gh-comment-id:435968260 --> @andrey-helldar commented on GitHub (Nov 5, 2018): The problem persists even in the most recent version of the framework - `5.7.12 ![2018-11-05_20-46-09](https://user-images.githubusercontent.com/10347617/48016171-f3899400-e13b-11e8-8d61-bba99a79442c.png) If you comment out the 146 line, then the monolog returns a real error, not its own.
Author
Owner

@andrey-helldar commented on GitHub (Nov 7, 2018):

This is both funny and not. I found a problem.
My project uses a package that is responsible for saving the exceptions to the database, then creating an application in jira and notifying in slack. This error was generated by the method of serialization of exceptions for writing. This is necessary in order to work with it as with the class of the executor during deserialization.
Why did the error occur in freshly installed applications? I first installed the entire package set ...

<!-- gh-comment-id:436539370 --> @andrey-helldar commented on GitHub (Nov 7, 2018): This is both funny and not. I found a problem. My project uses a [package](https://github.com/andrey-helldar/notify-exceptions/blob/master/src/Models/ErrorNotification.php#L36) that is responsible for saving the exceptions to the database, then creating an application in jira and notifying in slack. This error was generated by the method of serialization of exceptions for writing. This is necessary in order to work with it as with the class of the executor during deserialization. Why did the error occur in freshly installed applications? I first installed the entire package set ...
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#498
No description provided.