Ticket #146 (assigned defect)

Opened 4 years ago

Last modified 5 months ago

Problems with require_once with circular dependencies

Reported by: bart Assigned to: hans (accepted)
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

01/19/10 16:03:26 changed by hans

  • owner changed from somebody to hans.
  • status changed from new to assigned.

This is solved for php-5.3+ in changeset [372]

Doubt we will every fix this for earlier php versions because it is a lot of work, but who knows. Until then i'll leave this open.

02/23/10 10:49:17 changed by sim

decoration Changed 1 year ago by admin

bathtub Changed 1 year ago by admin

solar system Changed 1 year ago by admin

stair parts Changed 1 year ago by admin

solar supply Changed 1 year ago by admin

02/24/10 11:00:41 changed by sim

decoration Changed 1 year ago by admin

bathtub Changed 1 year ago by admin

solar system Changed 1 year ago by admin

stair parts Changed 1 year ago by admin

solar supply Changed 1 year ago by admin