|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-03-17 11:22 UTC] felipe@php.net
[2009-03-17 12:41 UTC] jesse dot collis at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 11 23:00:01 2025 UTC |
Description: ------------ In a simple test of preg_quote is showing the function is not behaving as it does in PHP 5.2.x. preg_quote is escaping '-' (minus) characters when it shouldn't. Reproduce code: --------------- Current Results ----------------------- var_dump(preg_quote("[0-2]")); => string(8) "\[0\-2\]" var_dump(preg_quote("0-2")); => string(4) "0\-2" var_dump(preg_quote("a-z 0-9~%.:_\-")); => string(20) "a\-z 0\-9~%\.\:_\\\-" Expected result: ---------------- the three lines printed above should come out the following way. var_dump(preg_quote("[0-2]")); => string(7) "\[0-2\]" var_dump(preg_quote("0-2")); => string(3) "0-2" var_dump(preg_quote("a-z 0-9~%.:_\-")); => string(17) "a-z 0-9~%\.\:_\\- "