php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22545 Failed to parse ending escape sequence char (\)
Submitted: 2003-03-05 00:04 UTC Modified: 2003-03-05 00:25 UTC
From: neo_in_matrix at msn dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.1 OS: Windows 2000/SP3/Hotfixes
Private report: No CVE-ID: None
 [2003-03-05 00:04 UTC] neo_in_matrix at msn dot com
I'm a newbie on PHP, so what I describe here may NOT be a bug. 

I understand that any character between a paif of single quotes does not get 'escaped'.

So I thought the follow small program will print
abc\
to the output screen (I'm using the so-named php-cli).

<?
$s = 'abc\';

print $s;
?>

Yet, I get the following message:
Parse error: parse error, unexpected $end in X:\dir\tes
t.php on line 6

But the following code runs just fine. It prints out
abc\088
That's exactly what I mean to do.

<?
$s = 'abc\088';

print $s;
?>

So my conclusion is that the engine has a little problem dealing with ending \ in a single-quoted string.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-05 00:25 UTC] magnus@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Try php -r "echo '\'';".
That will output only a '. Use \\ to output \.
And next time, look in the manual first.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 14 07:01:32 2025 UTC