Re: dirname(__FILE__)

From: Date: Thu, 24 Oct 2002 19:15:00 +0000
Subject: Re: dirname(__FILE__)
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-10228@lists.php.net to get a copy of this message
On Sun, 2002-10-20 at 15:15, Martin Jansen wrote: > On Tue Oct 15, 2002 at 06:1920PM +0200, Lukas Smith wrote: > > I want to once more start a little discussion about how to include files > > in pear packages. > > > > I for one intent to distribute all PEAR packages that I use as part of > > my application because I don’t want my system to break when an admin > > updates a pear package to a version that breaks BC etc. > > > > Therefore I would really welcome if people would use dirname(__FILE__) > > in their includes in order that packages don’t have to be in the include > > path. > > We should really make a clear final statement about this: According to > Derick, dirname(__FILE__) does not have a performance issue and it > really seems to be the best solution around. I'm +1 for adding this to > the coding standards and to use this for all future contributions. Stop the press! dirname(__FILE__) won't work anyway. It screws up require_once and include_once and may lead to redefinition errors. Say you have two PEAR trees in your include_path, for example one provided by your ISP and one for you. This means that a dirname-style include in a file in one tree will include the file only from that tree, and the "same" include in the second tree will try including the same file there, with a different path, which basically renders include_once useless. There are two problems that need fixing here: being able to run tests from within a development tree, and using PEAR on systems where you can't modify include_path. We have to deal with these, but dirname(__FILE__) will cause more problems than it solves. Consider this a veto. :-) - Stig -- Stig Sæther Bakken, Fast Search & Transfer ASA, Trondheim, Norway http://pear.php.net/wishlist.php/ssb

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