#31804 [NEW]: Problem with \ in single quotes ('abc\')

From: Date: Wed, 02 Feb 2005 03:37:48 +0000
Subject: #31804 [NEW]: Problem with \ in single quotes ('abc\')
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73233@lists.php.net to get a copy of this message
From: neo_in_matrix at msn dot com Operating system: Windows, Fedora Core 1 & 3 PHP version: Irrelevant PHP Bug Type: Strings related Bug description: Problem with \ in single quotes ('abc\') Description: ------------ It seems there is a small problem with the \ char in single quotes. I think the char \ is *not* an escape char in single quotes, as echo 'abc\x'; outputs abc\x But, the following code echo 'abc\'; gives an error: PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in x:\test.php on line 1 However, the code echo 'abc\\'; has no runtime error and it outputs abc\ but it should output (with two \ chars) abc\\ Reproduce code: --------------- echo 'abc\x'; echo 'abc\\'; echo 'abc\'; Expected result: ---------------- abc\x abc\\ abc\ Actual result: -------------- abc\x abc\ PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in x:\test.php on line 1 -- Edit bug report at http://bugs.php.net/?id=31804&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31804&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31804&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31804&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=31804&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=31804&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=31804&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=31804&r=needscript Try newer version: http://bugs.php.net/fix.php?id=31804&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=31804&r=support Expected behavior: http://bugs.php.net/fix.php?id=31804&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=31804&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=31804&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=31804&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31804&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=31804&r=dst IIS Stability: http://bugs.php.net/fix.php?id=31804&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=31804&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=31804&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=31804&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=31804&r=mysqlcfg

« previous php.bugs (#73233) next »