#47229 [NEW]: preg_quote should escape "-" (minus) as well

From: Date: Wed, 28 Jan 2009 12:23:37 +0000
Subject: #47229 [NEW]: preg_quote should escape "-" (minus) as well
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-133258@lists.php.net to get a copy of this message
From: daniel at code-emitter dot com Operating system: any, see docs PHP version: 5.2.8 PHP Bug Type: PCRE related Bug description: preg_quote should escape "-" (minus) as well 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 bug report at http://bugs.php.net/?id=47229&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47229&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47229&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47229&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47229&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47229&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47229&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47229&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47229&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47229&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47229&r=support Expected behavior: http://bugs.php.net/fix.php?id=47229&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47229&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47229&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47229&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47229&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47229&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47229&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47229&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47229&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47229&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47229&r=mysqlcfg

« previous php.bugs (#133258) next »