[UPHPU] Include file namespace collision detection

Jonathan Duncan jonathan at bluesunhosting.com
Mon Oct 29 16:48:13 MDT 2007


On 29 Oct 2007, at 16:30, Joshua Simpson wrote:

> This file's namespace is filled with: x, y, z, and add_em
>
> This file's namespace consists of str1, str2, and add_em.
>
> master.php
> <?php
> include_once('include1.php');
> include_once('include2.php');
> ...
> some operations
> ...
> add_em(5, 3, 2);
> ?>
>
> This results in a name collision;  since include2.php is called  
> last, it's
> add_em function will be used (since they're all stuffed into the  
> global
> namespace, much like a bloated turkey on Thanksgiving).   This can  
> result in
> a variety of problems, especially with many developers, and no  
> scaffolding
> to catch stuff like this.
>

Why not use classes in the include files and then you can instantiate  
and use the functions specifically?


> Sorry if I come off as a bit annoyed, but I'm peeved at having to  
> write PHP.
>

My condolences to you.  :P   :)


More information about the UPHPU mailing list