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

skylerkatz's avatar

php artisan error

I have been using Laravel 5 since it went stable, but after upgrading to 5.0.5 and up whenever I run php artisan route:list I get an error saying [ErrorException] Trying to get property of non-object

Any idea why this may be happening?

0 likes
15 replies
bobbybouwmann's avatar

I had this once when one of my routes contained an error, so check your routes carefully!

3 likes
bestmomo's avatar

Check controllers names in routes, because new command creates controllers instances.

skylerkatz's avatar
skylerkatz
OP
Best Answer
Level 29

Was able to debug the error by turning on verbose error reporting: php artisan route:list -v.

The errors were within a controller that was calling an incorrect type on an eloquent query.

Thanks for the help.

5 likes
akoper's avatar

Thank you, @skylerkatz , for posting what you did. I've been working hard all day writing recurrence functionality for my application and then finally getting it going from the artisan CLI because it will be run via cron job. It was a lot of work and I got it working from the browser/route/URL, but when I artisan'ed that same code, it threw a common error message and wouldn't work. I was sad, but Googling led me to this thread, your post about "-v" led me to add that to my artisan command, that led me to a more verbose error message, that led me to the exact problem, I was able to fix it, and now my thing works. I have been whipsawed emotionally, but I am happy now, and I'll take you out and buy you a beer if you're ever in Detroit.

1 like
newroseji's avatar

@skylerkatz I am getting following error.

php artisan route:list -v

[SoapFault] Gateway Time-out

Exception trace: () at C:\xampp01\htdocs\nno\vendor\artisaninweb\laravel-soap\src\Artisaninweb\SoapWrapper\Service.php:218 SoapClient->__doRequest() at n/a:n/a SoapClient->__call() at n/a:n/a SoapClient->authenticate() at n/a:n/a call_user_func_array() at C:\xampp01\htdocs\nno\vendor\artisaninweb\laravel-soap\src\Artisaninweb\SoapWrapper\Service.php:218 Artisaninweb\SoapWrapper\Service->call() at C:\xampp01\htdocs\nno\app\Data\Soap\SevOne\SevOneBase.php:97 ReflectionClass->newInstanceArgs() at C:\xampp01\htdocs\nno\vendor\compiled.php:1044 Illuminate\Container\Container->build() at C:\xampp01\htdocs\nno\vendor\compiled.php:980 Illuminate\Container\Container->make() at C:\xampp01\htdocs\nno\vendor\compiled.php:1501 Illuminate\Foundation\Application->make() at C:\xampp01\htdocs\nno\vendor\compiled.php:805 Illuminate\Container\Container->Illuminate\Container{closure}() at C:\xampp01\htdocs\nno\vendor\compiled.php:1027 Illuminate\Container\Container->build() at C:\xampp01\htdocs\nno\vendor\compiled.php:980 Illuminate\Container\Container->make() at C:\xampp01\htdocs\nno\vendor\compiled.php:1501 Illuminate\Foundation\Application->make() at C:\xampp01\htdocs\nno\vendor\compiled.php:1072 Illuminate\Container\Container->resolveClass() at C:\xampp01\htdocs\nno\vendor\compiled.php:1056 Illuminate\Container\Container->getDependencies() at C:\xampp01\htdocs\nno\vendor\compiled.php:1042 Illuminate\Container\Container->build() at C:\xampp01\htdocs\nno\vendor\compiled.php:980 Illuminate\Container\Container->make() at C:\xampp01\htdocs\nno\vendor\compiled.php:1501 Illuminate\Foundation\Application->make() at C:\xampp01\htdocs\nno\vendor\laravel\framework\src\Illuminate\Foundation\Console\RouteListCommand.php:161 Illuminate\Foundation\Console\RouteListCommand->getControllerMiddleware() at C:\xampp01\htdocs\nno\vendor\laravel\framework\src\Illuminate\Foundation\Console\RouteListCommand.php:142 Illuminate\Foundation\Console\RouteListCommand->getMiddleware() at C:\xampp01\htdocs\nno\vendor\laravel\framework\src\Illuminate\Foundation\Console\RouteListCommand.php:109 Illuminate\Foundation\Console\RouteListCommand->getRouteInformation() at C:\xampp01\htdocs\nno\vendor\laravel\framework\src\Illuminate\Foundation\Console\RouteListCommand.php:89 Illuminate\Foundation\Console\RouteListCommand->getRoutes() at C:\xampp01\htdocs\nno\vendor\laravel\framework\src\Illuminate\Foundation\Console\RouteListCommand.php:75 Illuminate\Foundation\Console\RouteListCommand->fire() at n/a:n/a call_user_func_array() at C:\xampp01\htdocs\nno\vendor\compiled.php:925 Illuminate\Container\Container->call() at C:\xampp01\htdocs\nno\vendor\laravel\framework\src\Illuminate\Console\Command.php:115 Illuminate\Console\Command->execute() at C:\xampp01\htdocs\nno\vendor\symfony\console\Symfony\Component\Console\Command\Command.php:257 Symfony\Component\Console\Command\Command->run() at C:\xampp01\htdocs\nno\vendor\laravel\framework\src\Illuminate\Console\Command.php:101 Illuminate\Console\Command->run() at C:\xampp01\htdocs\nno\vendor\symfony\console\Symfony\Component\Console\Application.php:874 Symfony\Component\Console\Application->doRunCommand() at C:\xampp01\htdocs\nno\vendor\symfony\console\Symfony\Component\Console\Application.php:195 Symfony\Component\Console\Application->doRun() at C:\xampp01\htdocs\nno\vendor\symfony\console\Symfony\Component\Console\Application.php:126 Symfony\Component\Console\Application->run() at C:\xampp01\htdocs\nno\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:94 Illuminate\Foundation\Console\Kernel->handle() at C:\xampp01\htdocs\nno\artisan:36

@akoper , @bestmomo , @bobbybouwmann What is the error in above case?

newroseji's avatar

Thank you @skylerkatz for the reply. After going through the link, I still didn't get my answers.

One thing that I noticed is: it did not show this error when I ran in Linux OS.

newroseji's avatar

I am still not able to figure out the root cause of my issue. @skylerkatz @akoper , @bestmomo , @bobbybouwmann

[root@localhost nno]# php artisan route:list -v

[Exception]
The variable 'wsdl' must be set.

Exception trace: () at /mnt/hgfs/lindos/nno/vendor/artisaninweb/laravel-soap/src/Artisaninweb/SoapWrapper/Extension/SoapService.php:35 Artisaninweb\SoapWrapper\Extension\SoapService->__construct() at /mnt/hgfs/lindos/nno/app/Data/Soap/SevOne/SevOneBase.php:47 App\Data\Soap\SevOne\SevOneBase->__construct() at n/a:n/a ReflectionClass->newInstanceArgs() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Container/Container.php:817 Illuminate\Container\Container->build() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Container/Container.php:656 Illuminate\Container\Container->make() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:644 Illuminate\Foundation\Application->make() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Container/Container.php:229 Illuminate\Container\Container->Illuminate\Container{closure}() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Container/Container.php:773 Illuminate\Container\Container->build() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Container/Container.php:656 Illuminate\Container\Container->make() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:644 Illuminate\Foundation\Application->make() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Container/Container.php:887 Illuminate\Container\Container->resolveClass() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Container/Container.php:848 Illuminate\Container\Container->getDependencies() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Container/Container.php:813 Illuminate\Container\Container->build() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Container/Container.php:656 Illuminate\Container\Container->make() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:644 Illuminate\Foundation\Application->make() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php:161 Illuminate\Foundation\Console\RouteListCommand->getControllerMiddleware() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php:142 Illuminate\Foundation\Console\RouteListCommand->getMiddleware() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php:109 Illuminate\Foundation\Console\RouteListCommand->getRouteInformation() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php:89 Illuminate\Foundation\Console\RouteListCommand->getRoutes() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteListCommand.php:75 Illuminate\Foundation\Console\RouteListCommand->fire() at n/a:n/a call_user_func_array() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Container/Container.php:523 Illuminate\Container\Container->call() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Console/Command.php:115 Illuminate\Console\Command->execute() at /mnt/hgfs/lindos/nno/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:257 Symfony\Component\Console\Command\Command->run() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Console/Command.php:101 Illuminate\Console\Command->run() at /mnt/hgfs/lindos/nno/vendor/symfony/console/Symfony/Component/Console/Application.php:874 Symfony\Component\Console\Application->doRunCommand() at /mnt/hgfs/lindos/nno/vendor/symfony/console/Symfony/Component/Console/Application.php:195 Symfony\Component\Console\Application->doRun() at /mnt/hgfs/lindos/nno/vendor/symfony/console/Symfony/Component/Console/Application.php:126 Symfony\Component\Console\Application->run() at /mnt/hgfs/lindos/nno/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:94 Illuminate\Foundation\Console\Kernel->handle() at /mnt/hgfs/lindos/nno/artisan:36

jack's avatar

I had the same thing today - In my case it was an error in \App\Providers\AuthServiceProvider I had been working on some auth rules and apparently didn't finish one.

  • Jack
benfransen's avatar

Just posting this here since my Google Search led me here. I was experiencing this behavior when using route model binding. I have two routes, the edit route was added later so I didn't really noticed the issue at first:

Route::get('app/resource/{resource}', 'ResourceController@update'); .. more routes .. Route::get('app/resource/someOtherName', 'ResourceController@doSomethingElse');

Laravel tried to fetch my 'someOtherName' as {resource} because the routes are considered to be the same. This of course makes a lot of sense, but I added the edit route a few days after I declared the other route so I missed upon this consequence ;)

james2doyle's avatar

I was getting this error when just running php artisan.

I checked my log and saw there was a problem accessing an object in one of my Service Providers. Turns out there was a cached item that was expecting an object but was returning null. So it was throwing an Exception.

I updated the code to catch and handle the exception and then everything was OK!

bhuvidya's avatar

wow thank you so much @skylerkatz - finding the cause of my error doing an artisan route:list (a syntax error in a controller) then enabled me to see that middleware was being doubled up on a route which was double loading my session and causing all sorts of headaches. phew.

1 like
umeshs_in's avatar

I am getting this error message and not able to find the root cause. I am a niewbie to Laravel and PHP. Any PHP artisan command that I run throws up an Parse error: Syntax error, unexpected '*', expecting ']'

umeshs_in's avatar

Problem solved.. I had by mistake removed '/' from one of the comments.

Please or to participate in this conversation.