#27896 [NEW]: eval

From: Date: Wed, 07 Apr 2004 04:06:25 +0000
Subject: #27896 [NEW]: eval
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-57610@lists.php.net to get a copy of this message
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

« previous php.bugs (#57610) next »