ID: 18590 Comment by: vma1 at abv dot bg Reported By: armageddon at raydan dot de Status: Verified Bug Type: Zend Engine 2 problem Operating System: WinXP Pro PHP Version: 5.0.0-dev New Comment:
Same effect here on Slackware Linux 9.0 Previous Comments: ------------------------------------------------------------------------ [2003-07-13 18:28:50] ephp at sharpdreams dot com I get the same problem on the latest build of the Win33 binary for PHP 5 test version. (Built On: Jul 13, 2003 06:30 GMT). It only happens for me when using an interface and a class that implements the interface in the same file. I get "cannot redeclare class output_ext" error. Using Windows XP Prof. and Apache 2 (as a module). Any word on if this will get fixed soon? ------------------------------------------------------------------------ [2003-03-09 19:58:03] ben at pirionsystems dot com dot au I have the same sort of thing happening with classes when the server is under high load particularily. The script I use is: <?php class blah { } class test extends blah { } $blah = new test(); ?> I'm running PHP 5.0.0 dev (built Mar 10 2003 00:10:43) under Apache 1.3.27 on Windows XP Pro. I'm also running cygwin (apache isn't running under cygwin), so to reproduce this problem I did: while (true); do wget http://localhost/test.php; done After going to mozilla and reloading the same page a quite a few times (about 30 seconds worth of CTRL-R), it comes up with: Fatal error: Cannot redeclare class blah in c:\www\test.php on line 2 ------------------------------------------------------------------------ [2002-10-17 22:45:46] [EMAIL PROTECTED] In latest version of ZendEngine 2 the last example results a core dump. Here is the backtrace: #0 0x80e42bc in _efree (ptr=0x401b4748, __zend_filename=0x813a0c0 "/home/rei/PHP_CVS/php4/Zend/zend_opcode.c", __zend_lineno=124, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /home/rei/PHP_CVS/php4/Zend/zend_alloc.c:238 #1 0x80f002d in destroy_zend_class (pce=0x8154e34) at /home/rei/PHP_CVS/php4/Zend/zend_opcode.c:124 #2 0x80fd25a in zend_hash_destroy (ht=0x814b840) at /home/rei/PHP_CVS/php4/Zend/zend_hash.c:541 #3 0x80f72a2 in zend_shutdown () at /home/rei/PHP_CVS/php4/Zend/zend.c:539 #4 0x80c3d9f in php_module_shutdown () at /home/rei/PHP_CVS/php4/main/main.c:1190 #5 0x8113004 in main (argc=2, argv=0xbffff7f4) at /home/rei/PHP_CVS/php4/sapi/cli/php_cli.c:753 #6 0x400b4f5c in __libc_start_main (main=0x8112590 <main>, argc=2, ubp_av=0xbffff7f4, init=0x8059b30 <_init>, fini=0x81135bc <_fini>, rtld_fini=0x4000ce30 <_dl_fini>, stack_end=0xbffff7ec) at ../sysdeps/generic/libc-start.c:129 ZE1 does not core however it does show 4 memory leaks: /home/rei/PHP_CVS/php4/Zend/zend_API.c(597) : Freeing 0x0836ED0C (44 bytes), script=z2.php /home/rei/PHP_CVS/php4/Zend/zend_API.c(585) : Actual location (location was relayed) /home/rei/PHP_CVS/php4/Zend/zend_hash.c(178) : Freeing 0x083696F4 (32 bytes), script=z2.php /home/rei/PHP_CVS/php4/Zend/zend_execute.c(1956) : Freeing 0x08368B3C (12 bytes), script=z2.php ------------------------------------------------------------------------ [2002-08-07 02:16:35] optikSmoke at subdimension dot com 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. ------------------------------------------------------------------------ [2002-07-27 05:54:33] armageddon at raydan dot de Updated to Apache 1.3.26 but still the same problem... ------------------------------------------------------------------------ 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