From cef35b5a535448d156559564b1a0830d1882cd60 Mon Sep 17 00:00:00 2001 From: Eugene Yurkevich Date: Mon, 10 Apr 2017 10:24:13 +0300 Subject: [PATCH] Directive with '+' not handled correctly, escape '+', resolve #48 --- RobotsTxtValidator.php | 1 + phpunit.xml | 1 + tests/Issue48Test.php | 26 ++++++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 tests/Issue48Test.php diff --git a/RobotsTxtValidator.php b/RobotsTxtValidator.php index 13d3fcb..706a976 100644 --- a/RobotsTxtValidator.php +++ b/RobotsTxtValidator.php @@ -192,6 +192,7 @@ private static function prepareRegexpRule($ruleValue) '/\$./' => '\$', '/\?/' => '\?', '/\./' => '\.', + '/\+/' => '\+', '/\*/' => '.*', ); diff --git a/phpunit.xml b/phpunit.xml index fd879dc..a1cf87d 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -23,6 +23,7 @@ tests/t1gorTest.php tests/MultipleUserAgentsRulesTest.php tests/Issue13Test.php + tests/Issue48Test.php diff --git a/tests/Issue48Test.php b/tests/Issue48Test.php new file mode 100644 index 0000000..605d6ad --- /dev/null +++ b/tests/Issue48Test.php @@ -0,0 +1,26 @@ + +getRules()); + + $this->assertTrue($robotsTxtValidator->isUrlAllow('/telecommandes-box-decodeur.html')); + } +}