From: mahesh dot vemula at in dot ibm dot com Operating system: RHEL 4, Windows XP PHP version: 5CVS-2007-09-28 (snap) PHP Bug Type: Strings related Bug description: strrchr() doesn't work as expected with heredoc string containing blank line
Description: ------------ strrchr() function can't find the new line when an heredoc string containing only a blank line is given as input, whereas it works fine when the heredoc string containing regular string with new line. This is noticed on php5 and php6. Reproduce code: --------------- <?php $str1 = <<<EOD EOD; $str2 = <<<EOD hello hiiiiiii EOD; //doesn't work as expected var_dump( strrchr($str1, $str1) ); var_dump( strrchr($str1, "\n") ); var_dump( strrchr($str1, " ") ); //works as expected var_dump( strrchr($str2, "\n") ); var_dump( strrchr($str2, " ") ); ?> Expected result: ---------------- string(1) " " string(1) " " string(1) " " string(9) " hiiiiiii" string(9) " hiiiiiii" Actual result: -------------- bool(false) bool(false) bool(false) string(9) " hiiiiiii" string(9) " hiiiiiii" -- Edit bug report at http://bugs.php.net/?id=42790&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42790&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42790&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42790&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42790&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42790&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42790&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42790&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42790&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42790&r=support Expected behavior: http://bugs.php.net/fix.php?id=42790&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42790&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42790&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42790&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42790&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42790&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42790&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42790&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42790&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42790&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42790&r=mysqlcfg