antonioribeiro / firewall

Firewall package for Laravel applications
BSD 3-Clause "New" or "Revised" License
1.39k stars 163 forks source link

Call to undefined method PragmaRX\Firewall\Firewall::blockAccess() #3

Closed m4tthumphrey closed 10 years ago

m4tthumphrey commented 10 years ago

Have just installed into my Laravel 4.1 project and get the following error:

Call to undefined method PragmaRX\Firewall\Firewall::blockAccess()

Your service provider returns an instance of Firewall for the firewall service and that class doesn't have a blockAccess method, but the service provider does.

All very odd...

m4tthumphrey commented 10 years ago

Looks like you just need to move blockAccess() to the Firewall class and make it public and change line line 33 of Blacklist.php to $firewall->blockAccess();

Not sure how this hasn't been spotted before...

antonioribeiro commented 10 years ago

Yeah, it was not published because this is something the package does automatically for you, but I understand sometimes you might need to do that manually, so I just pushed "fix".

m4tthumphrey commented 10 years ago

I don't understand? What do you mean the package does it automatically?

antonioribeiro commented 10 years ago

Yes. You just have to use the artisan commands:

php artisan firewall:blacklist 200.201.202.1

And it will say:

200.201.202.1 is now blacklisted

Then if someone at that IP try to access your application it will be automatically blocked.

Marwelln commented 10 years ago

Problem still exists.

Call to undefined method PragmaRX\Firewall\Filters\Blacklist::blockAccess()
        if ($firewall->isBlacklisted()) 
        {
            $firewall->log('[blocked] IP blacklisted: '.$firewall->getIp());

            return $this->blockAccess();
        }

Using "pragmarx/firewall" : "dev-master" with "minimum-stability": "stable".

antonioribeiro commented 10 years ago

It's now fixed, and it was odd. Thank you.