php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25375 Crash at redeclaring class attempt within foreach (too fatal error)
Submitted: 2003-09-03 03:59 UTC Modified: 2003-11-13 02:30 UTC
From: forseti at oak dot rpg dot pl Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 5CVS-2003-09-03 (dev) OS: Windows 98 SE
Private report: No CVE-ID: None
 [2003-09-03 03:59 UTC] forseti at oak dot rpg dot pl
Description:
------------
With PHP v. 5.0.0b2 on Win98 SE installed under Apache 1.3.22 as CGI an attempt to call an unexisting class variable inside foreach construct produces crash instead of error (possibly fatal).
Problem exist only when call is executed inside class declaration. Attempt to do this outside class declaration produces expected Warning: Invalid argument supplied for foreach() and Fatal error: Cannot redeclare class 


Reproduce code:
---------------
<?php 
class Test {
	var $a=array(1,2,3,4);
	function __construct() {
		foreach($this->b as $row) {
			if($row=='foo') {
				return true;
			}
		}
	}
} 


Expected result:
----------------
Warning: Invalid argument supplied for foreach() in <file> on line <line>

Fatal error: Cannot redeclare class test in <file> on line <line>


Actual result:
--------------
a crash

from Apache log:
[error] [client 127.0.0.1] Premature end of script headers: c:/php/php.exe

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-10 20:32 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2003-11-13 02:30 UTC] forseti at oak dot rpg dot pl
With latest (12-Nov) version all seems to be ok
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 20:01:27 2024 UTC