#44830 [NEW]: Very minor issue with backslash in heredoc

From: Date: Fri, 25 Apr 2008 11:21:28 +0000
Subject: #44830 [NEW]: Very minor issue with backslash in heredoc
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-124510@lists.php.net to get a copy of this message
From: slattery at uk dot ibm dot com Operating system: windows PHP version: 5.2.5 PHP Bug Type: Scripting Engine problem Bug description: Very minor issue with backslash in heredoc Description: ------------ There is a very minor issue when a heredoc contains only a single backslash. The doc says heredoc behaves exactly as double quoted string - so in this one particular case of the single backslash - we have a case which cannot be produced in a double quoted string - so the behaviour is undefined. The engine appears to treat is as a 'record separator', but I think it would be better treated as a backslash. Im quite happy for this to be closed as bogus - Its just that the code below is from a php test case - I dont suppose anyone will actually do this. Reproduce code: --------------- <?php $heredoc_string_only_backslash =<<<EOT \ EOT; $str = $heredoc_string_only_backslash; var_dump(bin2hex($str)); $str_addslashes = addslashes($str); var_dump(bin2hex($str_addslashes)); $str_stripslashes = stripslashes($str_addslashes); var_dump(bin2hex($str_stripslashes)); ?> Expected result: ---------------- On running the code I get: string(2) "00" string(4) "5c30" string(2) "00" which looks a little strange, I would have expected: string(2) "5c" string(4) "5c5c" string(2) "5c" -- Edit bug report at http://bugs.php.net/?id=44830&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=44830&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=44830&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=44830&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=44830&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=44830&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=44830&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=44830&r=needscript Try newer version: http://bugs.php.net/fix.php?id=44830&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=44830&r=support Expected behavior: http://bugs.php.net/fix.php?id=44830&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=44830&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=44830&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=44830&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44830&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=44830&r=dst IIS Stability: http://bugs.php.net/fix.php?id=44830&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=44830&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=44830&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=44830&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=44830&r=mysqlcfg

« previous php.bugs (#124510) next »