ID:               48686
 Comment by:       davide dot ferrari at atrapalo dot com
 Reported By:      codextasy at gmail dot com
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Windows, Linux
 PHP Version:      5.2.10
 New Comment:

Same grave bug here! But here it happens only when APC (3.0.19) is
enabled. Can the OP confirm it happens only with APC as well?


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

[2009-06-25 09:01:25] codextasy at gmail dot com

Description:
------------
There is a bug with cyclic inclusion of files with class definition.

There are three classes - A, B, C - each placed in a separate file -
A.php, B.php, C.php - all in the same directory.

B is a derived class of A, C is a derived of B.
So, B.php includes A.php (using require_once), C.php includes B.php.

A.php contains both class A and function f(), which is subsequently
called. f() includes 'C.php'.

When trying to request B.php (or include it from another file) I get
Fatal error: Class 'B' not found C.php on line 4.



Reproduce code:
---------------
Three files here:

--------[ A.php ]--------
<?

class A {}

function f()
{
  include 'C.php';
}

f();

?>
--------[ B.php ]--------
<?
require_once 'A.php';

class B extends A {}
?>

--------[ C.php ]--------
<?
require_once 'B.php';

class C extends B {}
?>


Expected result:
----------------
No error when requesting or including B.php.

Actual result:
--------------
Fatal error: Class 'B' not found in /srv/www/test/C.php on line 4


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


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

Reply via email to