php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10287 php parser error
Submitted: 2001-04-11 08:25 UTC Modified: 2001-07-16 12:04 UTC
From: robert dot samanek at post dot cz Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.4pl1 OS: win nt + linux (debian)
Private report: No CVE-ID: None
 [2001-04-11 08:25 UTC] robert dot samanek at post dot cz
hi, i'm afraid i found (by chance :-) ) a parser error. look at this code: 

<? 
$ar1=array (1,2,3); 
$ar2=array (4,5,6); 

if(list($ar1_val)=each($ar1)&&list($ar2_val)=each($ar2)) 
echo "Ok"; 
else 
echo "Error"; 
?> 

php simply hangs by parsing that (i tried it on both win and linux - last release, 4.0.4pl1). 

the cure is to add more parenthesis, like this: 

if((list($ar1_val)=each($ar1))&&(list($ar2_val)=each($ar2))) 

but anyway, php should not hang in the first case... 

bye

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-16 12:04 UTC] zeev@php.net
This crash is fixed.  Note, however, that it still doesn't behave in the way you seem to expect it to behave, due to precedence rules.

if (list($ar1_val)=each($ar1)&&list($ar2_val)=each($ar2)) 

is equivalent to
if (list($ar1_val) = (each($ar1)&&list($ar2_val)=each($ar2)))



 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC