|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-09-02 13:31 UTC] gopalv82 at yahoo dot com
[2007-02-25 03:33 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 10:00:02 2025 UTC |
Description: ------------ I am not sure if this is a design limitation of apc or if this can even be fixed. Because of apc php behaves differently when it comes to including class files and giving error messages for classes that have not been defined. This is an actual situation I came across in our codebase. I was able to provide a simplified code to reproduce. Reproduce code: --------------- This involves 3 files --- test.php --- <?php require_once( 'C.php' ); require_once( 'P.php' ); $t =& new C( ); ?> --- P..php --- <?php class P { function P( ) { echo 'inside p()'; } } ?> -- C.php -- <?php class C extends P { function C( ) { $p = get_parent_class( $this ); $this->$p( ); } } ?> Steps to reproduce: If you run test.php with clear cache you would get this error as is expected: Class c: Cannot inherit from undefined class p on line 3 in C.php But lets say we modify test.php to include P.php first and run test.php again so there is no error. Now P.php and C.php are both in the cache. At this point modify test.php again to include C.php first followed by P.php. The error you get is: Call to undefined Function () at C.php line 6 Note: in the actual codebase I dont have to keep modifying the order of includes because the files are included form other places I always get the wrong error. Expected result: ---------------- Depending at what point classes are cached the errors from php are different. I was expecting to get Cannot inherit undefined class all the time.