Bug #12278 Updated: variable variable inside a string
| From: | derick@php.net | Date: | Sun, 02 Jun 2002 18:09:48 +0000 |
| Subject: | Bug #12278 Updated: variable variable inside a string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-9201@lists.php.net to get a copy of this message | ||
ID: 12278
Updated by: derick@php.net
Reported By: dardo@uol.com.ar
-Status: Analyzed
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: independant
PHP Version: 4.0.6
New Comment:
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2001-07-20 14:14:23] zak@php.net
Are you sure that the output of:
<?php
$foo1="nonsense";
$foo2="foo1";
print "$$foo2";
?>
is: $foo2
Under PHP 4.0.6 (Win2k and Linux) the script generates $foo1 when I run
it.
From looking at the parser, this does not seem to be an error - at most
just an omission.
Perhaps one of the developers could comment? I don't know if the
behavior needs to be changed or just documented.
I would **guess** that we could extend the lexer to handle this by
adding something like:
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"$$" {
yy_push_state(ST_LOOKING_FOR_VARNAME);
return T_VARIABLE;
}
However, I have not tested it and really have no idea what I am doing!
:)
------------------------------------------------------------------------
[2001-07-20 08:15:32] dardo@uol.com.ar
<?php
$foo1="nonsense";
$foo2="foo1";
print "$$foo2";
?>
THIS programs output $foo2, (IS THIS OK??)
<?php
$foo1="nonsense";
$foo2="foo1";
print "{$$foo2}";
?>
this program outputs nonsense (THIS IS CORRECT)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=12278&edit=1