blackfireio / php-sdk

The Blackfire PHP SDK
https://blackfire.io
MIT License
150 stars 22 forks source link

Commands monitoring doesn't work for Laravel #61

Closed lkmadushan closed 3 years ago

lkmadushan commented 3 years ago
Argument 1 passed to Blackfire\Bridge\Laravel\ObservableCommandProvider::Blackfire\Bridge\Laravel\{closure}() must be an instance of Illuminate\Console\Events\CommandStarting, instance of Illuminate\Console\Events\ScheduledTaskStarting given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php on line 381 {"exception":"[object] (TypeError(code: 0): Argument 1 passed to Blackfire\\Bridge\\Laravel\\ObservableCommandProvider::Blackfire\\Bridge\\Laravel\\{closure}() must be an instance of Illuminate\\Console\\Events\\CommandStarting, instance of Illuminate\\Console\\Events\\ScheduledTaskStarting given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php on line 381 at /var/www/html/vendor/blackfire/php-sdk/src/Blackfire/Bridge/Laravel/ObservableCommandProvider.php:36)
lkmadushan commented 3 years ago

Fix: it seems like this line https://github.com/blackfireio/php-sdk/blob/ef112f9b49c9936523f997555548513e3a223f5a/src/Blackfire/Bridge/Laravel/ObservableCommandProvider.php#L36 has type hinted to receive CommandStarting object but it can be a ScheduledTaskStarting object as well.

thomasdiluccio commented 3 years ago

Hi @lkmadushan. Thanks a lot for raising the issue ... and fixing it. You're awesome! I'll push a fix as soon as possible.

dusandevic commented 3 years ago

Applied fix doesn't work properly. It obviously helps to get rid of the mentioned error, but there is another one:

Undefined property: Illuminate\Console\Events\ScheduledTaskStarting::$input {"exception":"[object] (ErrorException(code: 0): Undefined property: Illuminate\\Console\\Events\\ScheduledTaskStarting::$input at /home/forge/xxxxxxxxxx/releases/123123123/vendor/blackfire/php-sdk/src/Blackfire/Bridge/Laravel/ObservableCommandProvider.php:37)

thomasdiluccio commented 3 years ago

Hi @dusandevic. Thank you for raising this. I am exploring this so as to push a fix as soon as possible.

thomasdiluccio commented 3 years ago

@dusandevic The fix is in production: https://github.com/blackfireio/php-sdk/releases/tag/v1.27.1