Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cyberduck's avatar

Queues: PHP Fatal error: Uncaught ErrorException: get_class() expects parameter 1 to be object, null given in

A project that I am working on has been updated from Laravel 5.8 to 7. After the upgrade was done, I pulled the code and everything was running smoothly. However, I just recently updated my local machine from PHP 7.2 to 7.3 and cleared all my docker volumes.

Unfortunately, I can't seem to get the jobs to be dispatched anymore as the they fail returning:

PHP Fatal error: Uncaught ErrorException: get_class() expects parameter 1 to be object, null given in /var/www/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:109

After checking on StackOverflow, others seems to recommend downgrading to PHP 7.1 but I'm not convinced this is the best long term solution as the project runs perfectly fine on the prod server with PHP 7.3.

Any help would be appreciated, thanks.

0 likes
2 replies
cyberduck's avatar

After some debugging, I found out the pulled .env wasn't up to date which was causing the issue.

1 like
kikvors's avatar

I'm running into the same problem. Could you tell me what you changed in the .env file to make this work again?

1 like

Please or to participate in this conversation.