antonioribeiro / firewall

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

PHP Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in vendor\pragmarx\firewall\src\Firewall.php on line 584 #77

Closed jmichaelterenin closed 7 years ago

jmichaelterenin commented 7 years ago

Getting this error when attempting to perform: php artisan firewall:tables (no problems) php artisan migrate (error occurs)

I assumed you were referencing the geoip2/geoip2 package, even though you state that it's optional in the documentation, so I required it in my composer, performed a composer update, dump-autoload, and returning to the migration step, I still get the error.

Can you assist? Thanks

antonioribeiro commented 7 years ago

Which version are you using?

jmichaelterenin commented 7 years ago

Hi Antonio, Sorry for not including: Laravel 5.4, "pragmarx/firewall" : "^2.0", "geoip2/geoip2" : "~2.0",

antonioribeiro commented 7 years ago

Line 584 related to the updategeoip command

image

And it is not executed elsewhere.

jmichaelterenin commented 7 years ago

Sure, I saw that, but I'm sorry, I'm unfamiliar with the Geoip package, not sure what that means, I don't even plan on using any country blacklisting, just ip address ...

antonioribeiro commented 7 years ago

So, the problem was during "artisan migrate" or "artisan firewall:updategeoip"?

Could you, please send us the whole error message, and the call stack? Should appear in your laravel.log

jmichaelterenin commented 7 years ago

`[2017-08-25 12:13:56] local.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'syntax error, unexpected '->' (T_OBJECT_OPERATOR)' in C:\xampp\htdocs\explore\vendor\pragmarx\firewall\src\Firewall.php:584 Stack trace:

0 {main} `

That is the entire call stack. occurs with "artisan migrate"

antonioribeiro commented 7 years ago

You get nothing in storage/logs/laravel.log?

jmichaelterenin commented 7 years ago

Hi Antonio, What is highlighted in code (with the time stamp), is what I get in laravel.log

antonioribeiro commented 7 years ago

So files must have not downloaded as they should. Try to remove vendor/pragmarx and then

composer update

again

jmichaelterenin commented 7 years ago

ok, I'll let you know if it gets resolved with a fresh download, thanks

justplayingames commented 7 years ago

I see the same error

php version 5.6.24 pragmarx/firewall version": "v1.1.0",

It acts a syntax error. I get the error when attempting to serve my index page using php artisan serve. This route is using the firewall package.

A quick fix was to change line 521 to do it in two lines:

$updater = new GeoIpUpdater;
$success = $updater->updateGeoIpFiles($this->config->get('geoip_database_path'));

I confirmed the same fix on line 584 of pragmarx/firewall version 2.0.1

antonioribeiro commented 7 years ago

Just tagged version 2.0.2.

Thank you all.

jmichaelterenin commented 7 years ago

@justplayingames Thank you for assisting @antonioribeiro AOK now, thanks!