php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5251 Improper interpretation of braces ({}) in quoted strings
Submitted: 2000-06-28 16:48 UTC Modified: 2000-06-28 16:55 UTC
From: pdoyle at cncx dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Release Candidate 2 OS: Solaris 2.5.1
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: pdoyle at cncx dot com
New email:
PHP Version: OS:

 

 [2000-06-28 16:48 UTC] pdoyle at cncx dot com
When the scripting engine encounters a left brace ({) followed by a variable name, it assumes the brace is associated with the variable, and absorbs it and any matching right brace into the variable.

That is,

<?php echo "{$Hello}"; ?>

will produce "" as output, not "{}".  Also, 

<?php echo "{$Hello there}"; ?>

will produce an error:

Parse error: parse error, expecting `'}'' in /ch/admin.rt/www.admin-dev/html/home/test/test3.cgi on line 2

rather than the expected "{ there}".  

I presume this has to do with the improved variable referencing in quoted strings.  I noticed this in the context of the IMAP extension, which actually uses curly braces in its function arguments (see imap_open as an example).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-28 16:55 UTC] andrei at cvs dot php dot net
That is the consequence of the new functionality that allowes
extended variable access inside quoted strings. Use \{ to obtain
literal brace.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 07 12:01:35 2025 UTC