From: jfrim at idirect dot com Operating system: Win98SE PHP version: 5.2.0 PHP Bug Type: PCRE related Bug description: PCRE engine unable to output NULL characters
Description: ------------ The PERL-compatible regular expression engine is unable to output NULL characters correctly. This is evident with the preg_replace() function (tested), and seems likely evident with other PCRE functions (untested) according to some other but reports already submitted. Instead of returning a NULL character, a literal '\0' sequence is returned. Reproduce code: --------------- <?php $inputstring = "ASCII NUL\0, SOH\01, STX\02, ETX\03"; echo preg_replace('/([\\x00-\\x02])/e',"'['.ord('\\1').']'",$inputstring); ?> Expected result: ---------------- ASCII NUL[0], SOH[1], STX[2], ETX (Note that "ETX" is immediately followed by ctrl char #3) Actual result: -------------- ASCII NUL[92], SOH[1], STX[2], ETX (Note that "ETX" is immediately followed by ctrl char #3) The "92" is present in place of what should be "0" because preg_replace() incorrectly returns a literal '\0' sequence instead of a NULL character, and the ord() function then returns the value of the literal backslash. -- Edit bug report at http://bugs.php.net/?id=40395&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40395&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40395&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40395&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40395&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40395&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40395&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40395&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40395&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40395&r=support Expected behavior: http://bugs.php.net/fix.php?id=40395&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40395&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40395&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40395&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40395&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40395&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40395&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40395&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40395&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40395&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40395&r=mysqlcfg