#46574 [NEW]: Literal backslashes before other backslashes should also be escaped
| From: | francois at bonzon dot com | Date: | Fri, 14 Nov 2008 13:06:45 +0000 |
| Subject: | #46574 [NEW]: Literal backslashes before other backslashes should also be escaped | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-1501@lists.php.net to get a copy of this message | ||
From: francois at bonzon dot com
Operating system: BPJZ
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: Literal backslashes before other backslashes should also be escaped
Description:
------------
http://www.php.net/manual/en/language.types.string.php#language.types.st
ring.syntax.single says:
"To specify a literal backslash before a single quote, or at the end of
the string, double it (\\)."
This is incomplete, It should be added "before another backslash". Like
this:
"To specify a literal backslash before a single quote, before another
backslash, or at the end of the string, double it (\\)."
Reproduce code:
---------------
To echo a literal single-quoted string containing only two backslash
characters, I start by writing the enclosing quotes and the two backslashes
themselves:
echo '\\';
Then I should escape the second backslash, because it is "at the end of
the string". It gives
echo '\\\';
The first backslash, according the documentation, should not escaped,
because it is neither before a single quote or at the end of the string.
Expected result:
----------------
Two backslashes are echoed.
Actual result:
--------------
Parse error.
--
Edit bug report at http://bugs.php.net/?id=46574&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46574&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46574&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46574&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=46574&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=46574&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=46574&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=46574&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=46574&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=46574&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=46574&r=support
Expected behavior: http://bugs.php.net/fix.php?id=46574&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=46574&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=46574&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=46574&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46574&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46574&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=46574&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=46574&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=46574&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=46574&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=46574&r=mysqlcfg