t1gor / Robots.txt-Parser-Class

Php class for robots.txt parse

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

preg_match - fails for rules containing @

SpiderBro opened this issue · comments

The regex on line 389 fails for certain rules - I believe those containing an @ symbol (which do occur 'in the wild'). I think preg_quote would be the solution:

if (preg_match('@'.$robotRule.'@', $value)) {

=>

if (preg_match('@'.preg_quote($robotRule,'@').'@', $value)) {

Hi, @SpiderBro! Thanks for raising this up. Could you please send the pull-request with the fix? It would also be very helpful if you could write a small test, like those.

But thanks anyway 👍

Completely new to github, but have attempted to do this! See here:

#13

Merged, thanks.