#18590 [Com]: Fatal error: Cannot redeclare upon reload

From: Date: Wed, 07 Aug 2002 06:16:36 +0000
Subject: #18590 [Com]: Fatal error: Cannot redeclare upon reload
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-16111@lists.php.net to get a copy of this message
 ID:               18590
 Comment by:       optikSmoke@subdimension.com
 Reported By:      armageddon@raydan.de
 Status:           Open
 Bug Type:         Zend Engine 2 problem
 Operating System: WinXP Pro
 PHP Version:      4.3.0-dev
 New Comment:

I have also been having problems with the "redeclare upon 
reload" bug for awhile, so I decided to see if I could 
isolate the code that was causing the problem. After a 
good deal of thinning down code, I believe I have figured 
it out (for my case, anyway). Observe the following 
script: 
 
<? 
class biff { 
	function __destruct() { 
		exit(); 
	} 
} 
 
new biff(); 
?> 
 
The first time I load it, everything is fine. The second 
time, it says "Fatal error: Cannot redeclare class biff in 
biff.php on line 2". I hit reload again, and everything is 
fine. Hit it again, fatal error. And so on..... 
 
It appears that putting exit() in the __destruct() method 
of an object causes this problem. 
 
Further testing revealed that the script will die upon the 
first declaration of any class or function. For example, 
you could declare a function called "foo" before the 
"biff" class, and it would be reported as redeclared, 
instead of "biff". 
 
On top of that, testing with a function also indicates 
"where" the function was redeclared from. This is not a 
bug, but it is useful information: especially since it 
tosses up garbage. For example, adding the "function foo() 
{}" at the beginning of the file causes this error: 
 
Cannot redeclare foo() (previously declared in I+V?:2) in 
biff.php on line 2 
 
Generally, it seems to say "previously declared in 
biff.php" once, then every time afterwards it will turn up 
garbage for the file name. This garbage changes for each 
reload. 
 
I am using cvs from August 5th, with Zend 2, as a module 
in Apache 1.3.23, Mandrake 8.2 (kernel 2.4.18), and glibc 
2.2.4.


Previous Comments:
------------------------------------------------------------------------

[2002-07-27 05:54:33] armageddon@raydan.de

Updated to Apache 1.3.26 but still the same problem...

------------------------------------------------------------------------

[2002-07-27 05:16:39] derick@php.net

You can safely upgrade from 1.3.24 to 1.3.26, but I doubt that will fix
things.

Derick

------------------------------------------------------------------------

[2002-07-27 05:13:13] armageddon@raydan.de

> 1. Update Apache

I'm unable to update Apache because PHP fails to load as a module with
Apache 2.0.39.

> Umm in php.ini see if theres an execution time limit, if so change it
to 0

It was intended that the script stops after 5 seconds (And that's not
my problem...)

------------------------------------------------------------------------

[2002-07-26 22:25:50] rverlander@php.net

1. Update Apache
2. Umm in php.ini see if theres an execution time limit, if so change
it to 0

------------------------------------------------------------------------

[2002-07-26 16:49:32] sniper@php.net

reclassified and fixed version.


------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/18590

-- 
Edit this bug report at http://bugs.php.net/?id=18590&edit=1



Thread (30 messages)

« previous php.bugs (#16111) next »