NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
[resolved] Problems with require_once with circular deps


Joined: 08 Mar 2006
Posts: 10
Reply with quote
Hi,
I'm having a problem with phpexpress and I found that eaccelerator has the same problem.
http://eaccelerator.net/ticket/146

I tried the sample code with phpexpress and it failed the same way.
Is there any way this could be fixed? It would really be appreciated!

Thanks!
JoeK
View user's profileFind all posts by JoeKSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
the easiest workaround is to move all include/require statements into just one file,
or at least correct p.php (per sample) like below

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

and index.php like below:

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



in other words, a class should be declared before any other classes could inherit from it.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
[resolved] Problems with require_once with circular deps
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic