Re: nested includes fails?

From: Date: Tue, 04 May 2004 13:44:48 +0000
Subject: Re: nested includes fails?
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-9660@lists.php.net to get a copy of this message
Sorry for the delay... I didn't quite understand the problem, but I've tried to reproduce it: ----- \inc\a.php <?php class A { } ?> \inc\b.php <?php class B { } ?> \inc\common.php <?php require_once("a.php"); require_once("b.php"); ?> \inc\member.php <?php require_once("common.php"); class C { } ?> \inc\foo.php <?php require_once("common.php"); class D { } ?> ----- \member\member.php <?php require_once("../inc/common.php"); ?> \member\member2.php <?php require_once("../inc/member.php"); ?> \member\member3.php <?php require_once("../inc/member.php"); require_once("../inc/foo.php"); ?> ----- I can access \member.php, \member2.php and \member3.php all fine with no errors. Perhaps you've got a "common.php" in the \member directory? Because require_once("common.php") will use *that* common.php instead (and not the one in \inc\). Jevon ----- Original Message ----- From: "Andi Gutmans" <andi@zend.com> To: "Jevon Wright" <jevon@jevon.org>; "Tumurbaatar S." <tumurbaatar@datacom.mn>; <internals@lists.php.net> Sent: Tuesday, May 04, 2004 11:50 PM Subject: Re: [PHP-DEV] nested includes fails? > Can you give it a try with relative patches the way Tumurbaatar did? > > Andi > > At 11:41 PM 5/4/2004 +1200, Jevon Wright wrote: > >I tested it on PHP 5 RC1, Win XP SP1, IIS 5.1 running as CGI - it didn't > >fail. > >I tried it on PHP 5 RC2, Win XP SP1, IIS 5.1 running as CGI - it didn't fail > >then, either. > >(Calling c.php) > > > >a.php > > <?php require_once("common.php"); ?> > > > >b.php > > <?php require_once("common.php"); ?> > > > >c.php > > <?php > > require_once("a.php"); > > require_once("b.php"); > > ?> > > > >common.php > > <?php class Foo { } ?> > > > >Jevon > > > >----- Original Message ----- > >From: "Tumurbaatar S." <tumurbaatar@datacom.mn> > >To: <internals@lists.php.net> > >Sent: Tuesday, May 04, 2004 5:25 PM > >Subject: [PHP-DEV] nested includes fails? > > > > > > > 'common.php' contains some class definition and PHP5 fails with > > > 'PHP Fatal error: Cannot redeclare class ... in common.php...' when > > > script C.php starts. The file including map is: > > > > > > A.php: require_once(common.php) > > > B.php: require_once(common.php) > > > C.php: > > > require_once(A.php) > > > require_once(B.php) > > > > > > That is bug? When only one file is included (A or B), > > > the contents of 'common.php' is available, i.e. nested require > > > works. Only fails when nested and multiple require. > > > > > > P.S. I use PHP5 RC2 running as CGI on WinXP/IIS. > > > > > > -- > > > PHP Internals - PHP Runtime Development Mailing List > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > >-- > >PHP Internals - PHP Runtime Development Mailing List > >To unsubscribe, visit: http://www.php.net/unsub.php > > >

« previous php.internals (#9660) next »