php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49980 Escaping curly braces produces backslash in output - Please REVIEW this time
Submitted: 2009-10-23 23:30 UTC Modified: 2009-10-24 00:18 UTC
From: ronlentjes at yahoo dot com dot au Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.0 OS: Fedora 11
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: ronlentjes at yahoo dot com dot au
New email:
PHP Version: OS:

 

 [2009-10-23 23:30 UTC] ronlentjes at yahoo dot com dot au
Description:
------------
*PLEASE REVIEW*

You closed this in the middle of me adding a correction to my 
description. That was a bit annoying. Please have this reviewed with others before just closing it like that. This is NOT an old issue as this is a new suggestion for a way forward as customers are complaining! Slamming to door on them will only infuriate them!

Escaping curly braces produces backslash in output.

Bug #37263  	Escaping curly braces produces backslash in output.


PHP Bugs 	 
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #49978 	Escaping curly braces produces backslash in output - Suggested Fix
Submitted:	23 Oct 11:03pm UTC 	Modified:	23 Oct 11:06pm UTC
From:	ronlentjes at yahoo dot com dot au 	Assigned to:	
Status:	Bogus 	Category:	Scripting Engine problem
Version:	5.3.0 	OS:	Linux Fedora 11
View/Vote Developer Edit Submission

Welcome! If you don't have a SVN 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.
SVN Username: 		SVN Password: 		Remember: 	
Quick Fix: 	
Status: 		Assign to: 		
Category: 	
Summary: 	
From: 	ronlentjes at yahoo dot com dot au
New email: 	
Version: 		OS: 	
New/Additional Comment:

[23 Oct 11:03pm UTC] ronlentjes at yahoo dot com dot au

Description:
------------
Please refer to old case (from another author):

Escaping curly braces produces backslash in output.

Bug #37263  	Escaping curly braces produces backslash in output.

STATUS: Should not be bogus. It is a real issue not understood by PHP
staff. I do have a simple solution to this. Read on...

I noticed this bug come up in app.

I think you have misunderstood how bad this is and I consider this to be
a bug as well.

I understand you made a change so that \ infront of any character not on
the list of escapes will print \ with that offending character. This is
good.

All you have to do now is add { as an escape to the list so that \{
produces a single { that will solve all the problems. 

The original person who created this bug was trying to explain to you
that you gave no reasonable way ahead to fix old code and I think there
was miscommunication.

I too see this as a bug. What you missed in adding the VERY GOOD idea of
printing bad escapes, is the \{ has been a VALID ESCAPE in previous
versions. To fix this simply add { to your list of valid escapes and
produce a single { when encountered.

That will keep every one happy.

N.B. I now have to go through 1000's of lines of code and fix up every
occurance of this \{ which was realied apon as a very acceptable ESCAPE
sequence. (BUT NOW HAVE TO KEEP 2 VERSIONS!!)

Cheers,
Ron Lentjes
LC CLS.

Reproduce code:
---------------
When $ is involved:
{ -> nothing (0 chars)
\{ goes to \{ (2 chars)

This is illogical. How to go to just one character { in these
cases. No I don't accept \$ this is missing the point.

Expected result:
----------------
Please add { to list of acceptable ESCAPE sequences.
\{ -> always got to single { character and stop the following $
processing.

Effectively, this ESCAPE WAS in old version. But you didn't realize it
when you added code to produce BAD ESCAPES. You forgot that \{ was an
escape in old version.

So just add it and document it. 

That will solve all issues.


[23 Oct 11:06pm UTC] jani@php.net

You're couple of years too late. Still not a bug.



Correction:

Expected result:
----------------
Please add { to list of acceptable ESCAPE sequences.
\{ -> always go to single { character and *continue* the following $
processing as if { } were not present.


BTW. This is not couple year too late. 

This is brand new suggestion.

I am only trying to help customers. 

Please do not close this case so suddenly, I was just in middle of adding
more info about the correction as stated above.

The more you just slam dunk your customers, the more you obviously don't care
about the hard work we do to help customers.

Cheers,
Ron Lentjes
LC CLS.

N.B.Please REVIEW this. Backwards compitibility is a very important issue and can 
keep from customers flaring up about hours and hours of rework which costs them
enormous amounts of revenue.

You keep telling the to upgrade but your upgrades keep busting sites.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-23 23:42 UTC] ronlentjes at yahoo dot com dot au
I will now add simple test case to fully show this issue.
 [2009-10-23 23:49 UTC] ronlentjes at yahoo dot com dot au
I did this from command line to be very simple to test:
(I kept the \n away from example in separate echo just for clarity):

<?
$s = 'xxx';
echo "{$s}"; echo "\n";
echo "\{$s\}"; echo "\n";
echo "{\$s}"; echo "\n";
echo '(' . "$s" . '}'; echo "\n";
?>

Sorry, I did type this from other computer screen so typo possible.

The results for new versions:

xxx
\{xxx\}
{$s}
{xxx}

You see the misinterpretation of old user's case is that you thought they wanted {$s} to be printed by saying use \$. That is not what customers want. They want this result:

{xxx}

But now that you disabled \{ escaping, you must now put { into a variable or '{' string constant and change all code to concatenated with that string. As shown above with this piece of code:

echo '(' . "$s" . '}'; echo "\n";

That is really ugly. You used to be able to do this:

echo "\{$s}"; echo "\n";

That is the WHOLE point.

Cheers,
Ron Lentjes
LC CLS.
 [2009-10-24 00:18 UTC] johannes@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

Changing this again would be a trouble for everybody depending on the current behavior.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 10 18:01:34 2025 UTC