#27896 [Opn->Bgs]: eval
| From: | pollita@php.net | Date: | Wed, 07 Apr 2004 05:23:13 +0000 |
| Subject: | #27896 [Opn->Bgs]: eval | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-57611@lists.php.net to get a copy of this message | ||
ID: 27896
Updated by: pollita@php.net
Reported By: jesse at erieonline dot com
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: WinXP / FreeBSD
PHP Version: 4.3.5
New Comment:
Sorry, but 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 as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2004-04-07 00:06:25] jesse at erieonline dot com
Description:
------------
I have a variable called $config['sold_email_winner_message'], which
has an emal message template stored in the variable. Within this email
message, i have information like:
Dear $winner_info[first_name] $winner_info[last_name],
Congrates...
I use eval to evaluate the string. One thing I noticed is that the
following doesn't work
$winner_info['first_name'] $winner_info['last_name'], but
$winner_info[first_name] $winner_info[last_name] does work.
One would think that these should be interchangeable.
Reproduce code:
---------------
$winner_info = array ('first_name' => "First", 'last_name' =>
"Last");
This doesn't work:
$config['sold_email_winner_message'] = "Dear $winner_info['first_name']
$winner_info['last_name']";
eval ("\$config[sold_email_winner_message] =
\"$config[sold_email_winner_message]\";");
This does work:
$config['sold_email_winner_message'] = "Dear $winner_info[first_name]
$winner_info[last_name]";
eval ("\$config[sold_email_winner_message] =
\"$config[sold_email_winner_message]\";");
Expected result:
----------------
This will print the following:
Dear First Last
Actual result:
--------------
This will print the following:
Dear $winner_info['first_name'] $winner_info['last_name']
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27896&edit=1