From: joei at mail dot com Operating system: Linux PHP version: 4.3.8 PHP Bug Type: *Regular Expressions Bug description: ereg problem when use '\-'
Description: ------------ I found ereg function in php 4.3.8 doesn't match some expression that I think it must be matched. Look at example.. ereg('[\=\-]', 'a-b') = match ereg('[\-\=]', 'a-b') = unmatch I think 2 expressions is the same. But result is difference. Reproduce code: --------------- <? echo "ereg('[\=\-]', 'a-b') = " ; if (ereg('[\=\-]', 'a-b')) echo "match"; else echo "unmatch"; echo "<br>"; echo "ereg('[\-\=]', 'a-b') = " ; if (ereg('[\-\=]', 'a-b')) echo "match"; else echo "unmatch"; echo "<br>"; ?> Expected result: ---------------- ereg('[\=\-]', 'a-b') = match ereg('[\-\=]', 'a-b') = match Actual result: -------------- ereg('[\=\-]', 'a-b') = match ereg('[\-\=]', 'a-b') = unmatch -- Edit bug report at http://bugs.php.net/?id=29245&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29245&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29245&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29245&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29245&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29245&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29245&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29245&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29245&r=support Expected behavior: http://bugs.php.net/fix.php?id=29245&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29245&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29245&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29245&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29245&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29245&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29245&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29245&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29245&r=float