ID: 12278
Updated by: zak
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Assigned
Bug Type: Output Control
Operating System: independant
PHP Version: 4.0.6
New Comment:
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! :)
Previous Comments:
------------------------------------------------------------------------
[2001-07-20 08:15:32] [EMAIL PROTECTED]
<?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
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]