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

ixudra's avatar

Error when upgrading to Laravel 5.3

I upgraded my app to Laravel 5.3 from 5.2, no errors locally. But when I deploy to the server, the following error occurs:

BadMethodCallException in Macroable.php line 74: Method after does not exist.

    in Macroable.php line 74
    at Router->__call('after', array(object(AfterFilter))) in BootProviders.php line 17
    at Router->after(object(AfterFilter)) in BootProviders.php line 17
    at Application->boot() in BootProviders.php line 17
    at BootProviders->bootstrap(object(Application)) in Application.php line 203
    at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\DetectEnvironment', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders')) in Kernel.php line 254
    at Kernel->bootstrap() in Kernel.php line 145
    at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 117
    at Kernel->handle(object(Request)) in index.php line 57

I have no clue where this is coming from or even where to begin looking for the solution. I tried reverting back to 5.2 and removing all cached files (routes, config,...) but that didn't do anything. Any suggestions are welcome

0 likes
6 replies
Tirke's avatar

Do you have the Laravel 5.3 routes directory (it is a root directory) ?

ejdelmonico's avatar

Did you remove the arguments from boot as instructed by the upgrade guide? In EventServiceProvider remove

use Illuminate\Contracts\Events\Dispatcher as DispatcherContract;

change boot to

public function boot()
    {
        parent::boot();

        //
    }
ixudra's avatar

@Tirke Yes, I have the routes directory in my root with web, api and console files. The original routes.php has been deleted

@ejdelmonico All arguments from the boot methods in all ServiceProviders have been removed

Like I said: locally I have no issues, the site runs perfectly in 5.3. It all goes wrong as soon as I deploy to our staging server

ixudra's avatar

@freekmurze The bootstrap/compiled.php file has been removed so that is also not causing the problem..

ixudra's avatar
ixudra
OP
Best Answer
Level 4

Found the problem. Our current installation of newRelic is incompatible with Laravel 5.2-5.3, which is causing the issue. Took me a while to find it because the stack trace doesn't actually show the full class name, but found it through dd(). Solution is to upgrade your newRelic to a more recent version:

https://discuss.newrelic.com/t/php-agent-breaks-laravel-5-2/32801/31

Please or to participate in this conversation.