PHP 4.0 Bug #5251: Improper interpretation of braces ({}) in quoted strings
| From: | pdoyle at cncx dot com | Date: | Wed, 28 Jun 2000 20:48:22 +0000 |
| Subject: | PHP 4.0 Bug #5251: Improper interpretation of braces ({}) in quoted strings | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-22567@lists.php.net to get a copy of this message | ||
From: pdoyle@cncx.com
Operating system: Solaris 2.5.1
PHP version: 4.0 Release Candidate 2
PHP Bug Type: Scripting Engine problem
Bug description: Improper interpretation of braces ({}) in quoted strings
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).