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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 00:01:33 2024 UTC