ID:               48686
 Comment by:       pietro dot baldassarri at unibo dot it
 Reported By:      codextasy at gmail dot com
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: *
 PHP Version:      5.2.10
 New Comment:

Same problem here (Gentoo Linux PHP 5.2.10).
This bug seems some way related to this
http://bugs.php.net/bug.php?id=48787


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

[2009-06-25 10:31:38] codextasy at gmail dot com

I can reproduce the bug with or without APC installed/enabled.

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

[2009-06-25 10:06:08] davide dot ferrari at atrapalo dot com

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?

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

[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