D
D
Dima2016-11-28 12:48:11
Laravel
Dima, 2016-11-28 12:48:11

How to find a bug in lumen/laravel?

In the process of working with lumen, in case of a problem (apparently any, an error in the php syntax, no connection to the database, etc.), I get a page with a 500 error. And the following is in the logs:

PHP message: PHP Fatal error:  Uncaught TypeError: Argument 2 passed to Monolog\Logger::__construct() must 
be of the type array, object given, called in /panel/sites/vendor/laravel/lumen-framework/src/Application.php 
on line 391 and defined in /panel/sites/vendor/monolog/monolog/src/Monolog/Logger.php:141

Stack trace:
#0 /panel/sites/vendor/laravel/lumen-framework/src/Application.php(391): 
Monolog\Logger->__construct('lumen', Object(Monolog\Handler\StreamHandler))
#1 /panel/sites/vendor/illuminate/container/Container.php(746): 
Laravel\Lumen\Application->Laravel\Lumen\{closure}(Object(Laravel\Lumen\Application), Array)
#2 /panel/sites/vendor/illuminate/container/Container.php(644): 
Illuminate\Container\Container->build(Object(Closure), Array)
#3 /panel/sites/vendor/laravel/lumen-framework/src/Application.php(211): 
Illuminate\Container\Contai

As I understand it, this is a logger error, which should show me the true problem :)
Where did I go wrong?
PS
I removed the strict parameter check in Logger.php and everything worked... but I still wonder why this happened?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2016-11-28
@ollisso

Usually everything falls like this when there is an error in the config. Unfortunately, but does not report in which file the error is.
The "simple" way to find it is to install xdebug and put a breakpoint on the desired line. Further along the call branch, see where it throws the exception from and so that in this place it receives / what it should receive :)

N
Nimfus, 2016-11-28
@Nimfus

The logger constructor crashes, doesn't want to accept Object(Monolog\Handler\StreamHandler), the array asks for some reason.
It looks like a problem with the framework itself, it's worth trying composer update, if it doesn't help, look at the application's config files

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question