ID: 42790 Updated by: [EMAIL PROTECTED] Reported By: mahesh dot vemula at in dot ibm dot com -Status: Open +Status: Bogus Bug Type: Strings related Operating System: RHEL 4, Windows XP PHP Version: 5CVS-2007-09-28 (snap) New Comment:
See this simple example: <?php $str1 = <<<EOD EOD; var_dump($str1); ?> This code outputs 'string(0) ""', which explains why strrchr() or any other function will not find any characters including newline in there. The data in heredocs starts AFTER the initial new line and finished BEFORE the ending newline, so it looks like this: [START_DELIMITER and newline]data[newline and END_DELIMITER]. There is no data in your string, so strrchr() behaves correct. Previous Comments: ------------------------------------------------------------------------ [2007-09-28 16:48:51] mahesh dot vemula at in dot ibm dot com 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 this bug report at http://bugs.php.net/?id=42790&edit=1
