php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43531 Odd escape results from single and double quotes.
Submitted: 2007-12-07 22:20 UTC Modified: 2007-12-07 22:33 UTC
From: isawhim at gmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.2.5 OS: Linux
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: isawhim at gmail dot com
New email:
PHP Version: OS:

 

 [2007-12-07 22:20 UTC] isawhim at gmail dot com
Description:
------------
Using an "Escape" \ in certain quotes, results in literal translation.

Tested on \r \n \t inside Single and Double quotes.

Single Quotes does not escape.
Double Quotes escapes.

I can not find documentation to explain this behaviour, or warnings on pages, related to places where one might try to use an escape.

Processed all Escapes inside any single ' and double " quotes.
or...
{Possible feature request}
SingleQuoteEscape=(all|none|quotes)
DoubleQuoteEscape=(all|none|quotes)

All = \r \n \t \\ \' {\"}
None = literal quoted text, must use CHR strings (Iso), No like-quotes allowed.
Quotes = if {'} then \' escape, if {"} then \" escape

Reproduce code:
---------------
<?
$MyString1 = '\tTest1\r\nABC1';
$MyString2 = "\tTest2\r\nABC2";

echo($MyString1.'<BR>'.$MyString2.);
?>

Expected result:
----------------
Expected Output:
	Test1
ABC1
	Test2
ABC2

Actual result:
--------------
Actual Output:

\tTest1\r\nABC1
	Test2
ABC2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-07 22:33 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

See http://br.php.net/manual/en/language.types.string.php#language.types.string.syntax.single
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Sep 19 14:00:01 2025 UTC