php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49978 Escaping curly braces produces backslash in output - Suggested Fix
Submitted: 2009-10-23 23:03 UTC Modified: 2009-10-23 23:06 UTC
From: ronlentjes at yahoo dot com dot au Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.0 OS: Linux Fedora 11
Private report: No CVE-ID: None
 [2009-10-23 23:03 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-23 23:06 UTC] jani@php.net
You're couple of years too late. Still not a bug.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 10 17:01:32 2025 UTC