Ad

Antonioribeiro/firewall Package Throwing Errors After Upgrading To Laravel 5.2.5?

- 1 answer

I am working on a laravel application and decided to use antonioribeiro/firewall to manage IP restrictions throughout my application. The package is awesome and worked like a charm. Until recently when I upgraded to the latests laravel version 5.2.5 when the package started throwing and error, the stack to which I am pasting below:

[2015-12-29 09:23:20] local.ERROR: exception 'BadMethodCallException' with message 'Method filter does not exist.' in /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php:81
Stack trace:
#0 /home/vagrant/Code/archive/vendor/pragmarx/firewall/src/Vendor/Laravel/ServiceProvider.php(163): Illuminate\Routing\Router->__call('filter', Array)
#1 /home/vagrant/Code/archive/vendor/pragmarx/firewall/src/Vendor/Laravel/ServiceProvider.php(163): Illuminate\Routing\Router->filter('fw-block-bl', '\\PragmaRX\\Firew...')
#2 /home/vagrant/Code/archive/vendor/pragmarx/firewall/src/Vendor/Laravel/ServiceProvider.php(67): PragmaRX\Firewall\Vendor\Laravel\ServiceProvider->registerFilters()
#3 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(531): PragmaRX\Firewall\Vendor\Laravel\ServiceProvider->register()
#4 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php(74): Illuminate\Foundation\Application->register(Object(PragmaRX\Firewall\Vendor\Laravel\ServiceProvider))
#5 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(507): Illuminate\Foundation\ProviderRepository->load(Array)
#6 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterProviders.php(17): Illuminate\Foundation\Application->registerConfiguredProviders()
#7 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(203): Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap(Object(Illuminate\Foundation\Application))
#8 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(208): Illuminate\Foundation\Application->bootstrapWith(Array)
#9 /home/vagrant/Code/archive/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(105): Illuminate\Foundation\Console\Kernel->bootstrap()
#10 /home/vagrant/Code/archive/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 {main}  

Now I am not an expert but I think this line:

$this->app['router']->filter('fw-block-bl', '\PragmaRX\Firewall\Filters\Blacklist');

is responsible for throwing the error. My best guess is that maybe filters are deprecated in 5.2.5 and there is no longer a filter method or maybe it was renamed to something else. In either case I don't know how to fix this. I am not using the filters that ship with the package as it is. I have written my own custom middleware to work with. How do I go around this problem?

Ad

Answer

So I had not updated to the newer version of the package available and the even more frustrating problem I faced was that the newer package bundled the older version (~0.5) of the support package from the same user and I had to forcefully update to the newer version (~0.6) of the support package too.

Github issue

Ad
source: stackoverflow.com
Ad