terrylinooo / shieldon

Web Application Firewall (WAF) for PHP.
https://shieldon.io
MIT License
838 stars 96 forks source link

Update SetupTrait.php #36

Closed Lucisu closed 3 years ago

Lucisu commented 3 years ago

Prevents issues like that when you don't have any rule saved in IP Manager:

Notice: Trying to access array offset on value of type bool in /var/www/html/vuln/vendor/shieldon/shieldon/src/Firewall/Firewall/SetupTrait.php on line 317

Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /var/www/html/vuln/vendor/shieldon/shieldon/src/Firewall/Firewall/SetupTrait.php on line 317

And, as the URL rule can be empty, the change at 319 line prevents this error:

Warning: strpos(): Empty needle in /var/www/html/vuln/vendor/shieldon/shieldon/src/Firewall/Firewall/SetupTrait.php on line 318

codecov[bot] commented 3 years ago

Codecov Report

Merging #36 (fe276e1) into 2.x (d244050) will decrease coverage by 0.02%. The diff coverage is 66.66%.

Impacted file tree graph

@@              Coverage Diff              @@
##                 2.x      #36      +/-   ##
=============================================
- Coverage     100.00%   99.97%   -0.03%     
- Complexity      1171     1173       +2     
=============================================
  Files             88       88              
  Lines           3967     3969       +2     
=============================================
+ Hits            3967     3968       +1     
- Misses             0        1       +1     
Impacted Files Coverage Δ Complexity Δ
src/Firewall/Firewall/SetupTrait.php 99.40% <66.66%> (-0.60%) 40.00 <0.00> (+2.00) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d244050...fe276e1. Read the comment docs.