ID: 31339 User updated by: bart at mediawave dot nl Reported By: bart at mediawave dot nl -Status: Bogus +Status: Open Bug Type: Scripting Engine problem Operating System: WinXP PHP Version: 5.0.3 New Comment:
damned... Now I feel really stupid... Previous Comments: ------------------------------------------------------------------------ [2004-12-30 10:58:23] [EMAIL PROTECTED] You need to escape use of vars inside your eval'ed string otherwise they are substituted with the value. Your eval'ed code looks like something like: echo "hello"; 'Why did the chicken cross the road?' = 'Why did the chicken cross the road?' which obviously is wrong ------------------------------------------------------------------------ [2004-12-30 00:20:17] bart at mediawave dot nl Description: ------------ My script depends heavily on eval and since I upgraded to PHP 5.0.3 everything completely broke down. (I think I was using 5.0.0 before I upgraded) (And yes, I know, Using eval() is a very dirty thing to do ;) ) After hours and hours of pinpointing I found out that things go wrong when code is running through eval(). The same code running directly (without eval()) runs flawlessly. It looks like there are some parsing problems with eval() or something. I'm also getting weird ODBC problems as soon as correctly working code runs through eval(): Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver]Invalid use of null pointer , SQL state S1009 in SQLExecDirect in D:\php\includes\sp6\modules\bwceval.php(33) : eval()'d code on line 24 I got the above warning out of the command line version of PHP since IIS only gave me a: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: Anywayz. I've got some very simple code that reproduces my problem: Reproduce code: --------------- <?php echo 'hello'; $myvar = 'Why did the chicken cross the road?'; $string = " echo 'hello'; $myvar = 'Why did the chicken cross the road?'; "; eval ($string); ?> Expected result: ---------------- hellohello Actual result: -------------- hello Parse error: syntax error, unexpected T_STRING in D:\Inetpub\wwwroot\test4.php(24) : eval()'d code on line 5 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31339&edit=1