php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43811 Line Continuation Characters inside string are being removed
Submitted: 2008-01-11 02:45 UTC Modified: 2008-01-11 10:43 UTC
From: steve1011 at att dot net Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.5 OS: Windows 2003 server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: steve1011 at att dot net
New email:
PHP Version: OS:

 

 [2008-01-11 02:45 UTC] steve1011 at att dot net
Description:
------------
If a string contains backslash newline, in any form of input or string building, those characters are removed as if the parser is processing a script line. All other languages that I know of only remove the line continuation if it occurs outside of a string definition and leaves the inside of strings alone (other than normal escape sequences of double quoted strings). php even strips the backslash newline from text submitted through a web form and referenced as $_REQUEST['varname'].

Line continuation characters effected are:

backslash newline
backslash carriage return
backslash equal sign
backslash 0x10

There may be more. I haven't completed testing yet, but will update this bug report if I find more.

Reproduce code:
---------------
I've tried test strings (letter e, backslash, newline, letter e) like:

"e\\\ne" becomes "ee"
'e\'."\n".'e' becomes 'ee'
'e\'.0x0a.'e' becomes 'ee'
"e\\\x0ae" becomes "ee"

you get the idea.

If I [sic] escape the string like this:

"e\\\\\x0a\x0ae" I get the expected [e, backslash, newline, e] string.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-11 10:43 UTC] steve1011 at att dot net
Never mind.

Stand alone testing showed one of my test strings was malformed and the others don't actually exibit the problem. Correctly formed strings (e backslash newline e) are not being changed by php parser. The problem appears to be related to mssql_query, the db client, or database, as the above test string as stored in the database ends up as ee. When inserted as (e backslash backslash newline newline e) the original string is stored. This does indicate a problem somewhere, but not the problem stated on this bug report.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Dec 21 18:00:02 2025 UTC