Ticket #146 (new defect)

Opened 2 years ago

Last modified 2 years ago

Problems with require_once with circular dependencies

Reported by: bart Assigned to: somebody
Priority: major Milestone: 0.9.6
Component: eAccelerator Version:
Keywords: require_once Cc: c960657

Description

I have two child classes C1 and C2 that both inherit from a parent class P.

P inherits from the class GP (grandparent).

P, C1 and C2 are in separate files, P.php, C1.php and C2.php, respectively. GP is defined in index.php.

C1.php:

<?php
require_once 'P.php';
class C1 extends P { }
?>

C2.php:

<?php
require_once 'P.php';
class C2 extends P { }
?>

P.php:

<?php
require_once 'C2.php';
class P extends GP {
function getC2() {
return new C2();
}
}
?>

index.php:

<?php
class GP { }
require_once 'C1.php';
echo 'Done';
?>

As one can see, C1 and C2 require the file containing their parent class P.php. P require's the file containing one of its children, C2 (this is necessary because P is used to create instances of C2).

Now, when index.php is called without eAccelerator being enabled, everything works fine.

When index.php is called with eAccelerator enabled, the following error occurs:

Fatal error: Class 'P' not found in
/var/home/dr/public_html/ea/C2.php on line 3

I assume that eAccelerator has problems handling the circular file dependencies.

I am using eAccelerator v0.9.3-rc2, PHP Version 5.0.4, Zend Engine v2.0.4-dev

Attachments

testcase.zip (0.8 kB) - added by bart on 07/24/06 17:39:41.

Change History

07/24/06 17:39:41 changed by bart

  • attachment testcase.zip added.

07/24/06 17:40:25 changed by bart

  • component changed from Control panel to eAccelerator.
  • milestone set to 0.9.5.

07/24/06 17:52:02 changed by c960657

  • cc set to c960657.

07/24/06 18:37:28 changed by hans

Confirmed with php-5.1.4 and SVN [236]

08/03/06 12:54:33 changed by bart

  • milestone changed from 0.9.5 to 0.9.6.

This is a hard one which could require a lot of changes, moving this to 0.9.6