php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50564 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in ...
Submitted: 2009-12-23 18:32 UTC Modified: 2009-12-23 20:48 UTC
From: wyattstorch42 at gmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.2.12 OS: Linux
Private report: No CVE-ID: None
 [2009-12-23 18:32 UTC] wyattstorch42 at gmail dot com
Description:
------------
Hello,

I have slaved over this one line of code and confirmed that there is absolutely nothing wrong with it. I have even modified it and received the same error. The error even persists when the line is commented out.

I receive a parse error as well as a warning for the backslash.

Reproduce code:
---------------
<?php
 $contents = "<?php\r\n \$galleryDesc = \"".addslashes($galleryDesc)."\";\r\n";
?>

Expected result:
----------------
I expected the value of $contents to be:
<?php
 $galleryDesc = "...";


Actual result:
--------------
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in ... on line ...

Parse error: syntax error, unexpected T_STRING in ... on line ...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-23 20:48 UTC] scottmac@php.net
Works here in PHP 5.3.2-rc1. The usual reason for this happening is an incorrect number of concurrent backslashes.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 01 21:01:29 2024 UTC