Re: dirname(__FILE__)

From: Date: Thu, 24 Oct 2002 23:25:03 +0000
Subject: Re: dirname(__FILE__)
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-10236@lists.php.net to get a copy of this message
On Fri, 25 Oct 2002 00:38:44 +0200 Wolfram Kriesing <lists@kriesing.de> wrote: > imagine you have an old PEAR::someClass in tree one, which has an old > API but in tree two the API of this class is the newest but since the > application that works with the old API, so to say tree one is so huge, > approved and stable that you dont want to or cant change the entire > application, you need to have exactly this setup as dirname(__FILE__) > would provide. i came across this problem a lot of times. and > dirname(__FILE__) would solve it! > > or do i not understand something here? The catch is: What happens when you need to combine applications or just application components that all rely to some extent on PEAR classes - some providing their own copy of a certain class for stability / BC assurance or whatever reasons, and some are using the standard PEAR installation. In this case, you could end up with one file including: include_once('/path/to/my/app/HTML/IT.php'); and another including: include_once('HTML/IT.php'); PHP would treat these as two different paths (even if both paths would end up to be the same when you resolve the include_path), so what you´d get is a double class declaration which would cause the parser to throw errors. On a side note and completely off topic: Is it normal that I can in fact declare functions with the same name multiple times as long as they´re contained in a class, even if it´s the same class? I noticed that PHP will not throw any error, but use the last function that was declared instead, overwriting the other ones. When I do this outside of a class the parser exits with an error - and that´s the way it should be, IMHO. Or is it just a bug in PHP? Regards, Markus -- Markus Wolff <wolff@21st.de>

« previous php.pear.dev (#10236) next »