PHP claims that class was defined twice
| From: | Jens Kisters | Date: | Sun, 20 May 2001 12:37:10 +0000 |
| Subject: | PHP claims that class was defined twice | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-53607@lists.php.net to get a copy of this message | ||
Hey there i noticed sometinh quite odd when trying to include a class
definition:
There are several classes in the project in question.
Every class resides i a separate file that gets included.
When i call the following method
function mRenderPrintNav($client) {
show_var("",get_declared_classes());//debugcode
include($this->pApp->pPath."/".$this->pApp->pCommonPath."/layernav.cls.php");
//include the class definition
$menu=new Menu;
$this->mRenderNavWalk($client,&$menu);
$menu->printMenu();
}
PHP complains
Fatal error: Cannot redeclare class menu in ..//_common/layernav.cls.php
on line 3
ok i started checking if i include the file twice, ich wrote some chars
before the first <?
in the class file, and i see the chars once, but not twicw.
There is no other class called menu in the same project.
So i checked the defined classes with PHP's get_declared_classes().
if i check the declared classes *before* the include it says that the
class Menu is defined.
if i uncomment the include (it is called after get_declared_classes())
the class is not defined at all.
weird.i dont get it.
maybe you do
thank you guys
Jens
--
Grüße aus dem schönen Kleve
Jens Kisters
rosomm et partner
Agentur für neue Medien GmbH
Dienstleistungszentrum am
Weißen Tor - Eingang B
Gocher Landstrasse 2
47551 Kleve / Bedburg-Hau
Telefon: 02821 - 97856-20
Telefax: 02821 - 97856-77
j.kisters@rosomm-partner.de
http://www.rosomm-partner.de