t1gor / Robots.txt-Parser-Class

Php class for robots.txt parse
MIT License
83 stars 31 forks source link

Fix rules ending with $. #80

Closed Poky85 closed 6 years ago

Poky85 commented 6 years ago

This is fix for issue #63.

Original check didn't considered rules containing *. So condition if (mb_strlen($escaped) - 1 == mb_strlen($path)) { tested exact length match between rule and path.

In pull request there is added start-of-string check for rules not beginning with * (see robots.txt specs https://developers.google.com/search/reference/robots_txt#url-matching-based-on-path-values). Then string length condition mentioned above is no longer needed.

I have fixed Composer to ~3.7 because old rule >=3.7 resolved to Composer 7 which is not compatible with tests. Upgrading tests is not in scope of this issue.

t1gor commented 6 years ago

Hello, @Poky85. Thanks for submitting the pull request.

I'll gladly accept it.

Nevertheless, could you please add a short test for this change? I guess there is some test data available in #63 already, right? This is not a show-blocker, but I would really appreciate the effort.

Thanks!

Poky85 commented 6 years ago

@t1gor Sure, test added in #81.