Ticket #146 (assigned defect)
Problems with require_once with circular dependencies
| Reported by: | bart | Owned by: | hans |
|---|---|---|---|
| Priority: | major | Milestone: | |
| 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
Change History
comment:1 Changed 4 years ago by bart
- Component changed from Control panel to eAccelerator
- Milestone set to 0.9.5
comment:4 Changed 4 years ago 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
comment:5 Changed 8 months ago 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.
comment:6 Changed 6 months ago 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
comment:7 Changed 6 months ago 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
