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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: robert dot samanek at post dot cz
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 23:01:27 2025 UTC