#31339 [Opn-Bgs]: Strange parser errors with eval

2004-12-30 Thread derick
 ID:   31339
 Updated by:   [EMAIL PROTECTED]
 Reported By:  bart at mediawave dot nl
-Status:   Open
+Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: WinXP
 PHP Version:  5.0.3
 New Comment:

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


Previous Comments:


[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=31339edit=1


#31339 [Opn-Bgs]: Strange parser errors with eval

2004-12-30 Thread bart at mediawave dot nl
 ID:   31339
 User updated by:  bart at mediawave dot nl
 Reported By:  bart at mediawave dot nl
-Status:   Open
+Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: WinXP
 PHP Version:  5.0.3
 New Comment:

whoops... bag to Bogus again...


Previous Comments:


[2004-12-30 11:09:23] bart at mediawave dot nl

damned... Now I feel really stupid...



[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=31339edit=1