Re: "Namespace polution" in includes
| From: | Sebastian Delmont | Date: | Fri, 18 Jan 2002 01:37:07 +0000 |
| Subject: | Re: "Namespace polution" in includes | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-3977@lists.php.net to get a copy of this message | ||
Alexander Merz wrote:
>
> This problem is already admits. The solution is the ZendEngine2 (aka PHP
5)
> which support namespaces and a perl-like package including.
"Tomas V.V.Cox" wrote :
> if you use a Unix OS you could solve that problem simply by renaming
> your directories to lower case. If not and your case is critical, here
> is your "require_pear" function:
>
> function require_pear($file) {
> $old = ini_set('include_path', $path_to_pear);
> require_once $file;
> ini_set('include_path', $old);
> }
>
Well... waiting for PHP 5, just to see if it includes the appropiate
functionality, and then trying to come out with a new way of doing things
doesn't seem very smart to me.
Neither is forcing users to change their directories to lower case... or
trying to avoid names that collide with PEAR, specially when the list of
names in PEAR is still growing.
In my oppinion, this whole issue looks like a complete oversight. Maybe
those who decided on the directory structure were not heavy users of
includes or include paths for things other than PEAR. I don't really (and
can't) know the reasons.
But it is a problem... and it's only going to get worse as time passes,
since PEAR will have a bigger user base.
I don't think there will be a better time in the future to address this
issue.
If you ask me, I think the "standard" should be changed right now to use a
"root" PEAR directory, and "include 'PEAR/Mail/sendmail.php';"
I think that's the best that could be done with the current tools in PHP...
Since PHP 5 might come too late.
And yes, it means changing all include and require statements on all PEAR
files.
And yes, it also means forcing existing PEAR users to change their scripts
or their include_paths.
But tomorrow there are going to be more users, not less... more files, not
less...
In my case, this "bug" is definetively a show-stopper... I'm not going to
use PEAR if it can clash with my current or existing files...
But the problem is even worse for other users. I know about PEAR, and I know
the problems it can cause... but what happens to a poor guy that updates to
PHP 4.1.1 and finds his "Mail/sendmail.php" page is no longer working? Will
he know that the reason is because PHP installed some files for something
named PEAR that are now more important that his own files?