Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9647 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7416 invoked by uid 1010); 4 May 2004 05:46:26 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 7381 invoked from network); 4 May 2004 05:46:25 -0000 Received: from unknown (HELO smtp2.actcom.co.il) (192.114.47.35) by pb1.pair.com with SMTP; 4 May 2004 05:46:25 -0000 Received: from actcom.net.il (line106-24.adsl.actcom.co.il [192.117.106.24]) by smtp2.actcom.co.il (8.12.8/8.12.8) with ESMTP id i445kF44020115; Tue, 4 May 2004 08:46:15 +0300 Message-ID: <40972E8D.5090804@actcom.net.il> Date: Tue, 04 May 2004 08:47:57 +0300 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7b) Gecko/20040404 X-Accept-Language: en-gb, en-us, en, he, ru MIME-Version: 1.0 To: "Tumurbaatar S." CC: internals@lists.php.net References: <20040504052554.60192.qmail@pb1.pair.com> In-Reply-To: <20040504052554.60192.qmail@pb1.pair.com> X-Enigmail-Version: 0.83.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] nested includes fails? From: ilya79@actcom.net.il (Ilya Sher) Tumurbaatar S. wrote: > '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. > That seems to be the correct behaviour for both PHP5 and PHP4. A class should never be defined twice - but that's the case when you include or execute somehow else the code with class definition (common.php) more than once.