ID: 47229
Updated by: [email protected]
Reported By: daniel at code-emitter dot com
-Status: Open
+Status: Bogus
Bug Type: PCRE related
Operating System: any, see docs
PHP Version: 5.2.8
New Comment:
The '-' just have special meaning in the regex when used whithin '[ ]',
which are escaped as expected. So, there is no possibility to '-' break
something.
var_dump(preg_quote("[0-2]")); // string(7) "\[0-2\]"
Previous Comments:
------------------------------------------------------------------------
[2009-01-28 12:23:33] daniel at code-emitter dot com
Description:
------------
preg_quote does not escape the "-" (minus) character but it should.
Reproduce code:
---------------
preg_quote("0-9", '/')
Expected result:
----------------
preg_quote("0-9", '/') == "0\-9"
Actual result:
--------------
preg_quote("0-9", '/') == "0-9"
Depending on the used string this can become a dead loss of the used
regular expression because all characters become valid.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47229&edit=1