From:             jesse at erieonline dot com
Operating system: WinXP / FreeBSD
PHP version:      4.3.5
PHP Bug Type:     Unknown/Other Function
Bug description:  eval

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 bug report at http://bugs.php.net/?id=27896&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27896&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27896&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27896&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27896&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27896&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27896&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27896&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27896&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27896&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27896&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27896&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27896&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27896&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27896&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27896&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27896&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27896&r=float

Reply via email to