Re: Re: RFC: Dropping Namespace
| From: | Derick Rethans | Date: | Wed, 05 Dec 2007 08:39:39 +0000 |
| Subject: | Re: Re: RFC: Dropping Namespace | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33719@lists.php.net to get a copy of this message | ||
On Tue, 4 Dec 2007, Gregory Beaver wrote:
> However, in the global scope (no namespace) it would fail. This is a
> bug that is easily fixed. use should allow re-aliasing of global
> classes, and I could provide a very easy fix.
No, use should not allow this. Take the following example:
<?php
namespace blah;
use DomDocument as test;
class DOMDocument { }
$dom = new DOMDocument; //
$dom->loadXML('<books><book><title>blah</title></book></books>');
$s = simplexml_import_dom($dom);
echo $s->book[0]->title; // blah
?>
Besides this being a *big* WTF factor (why is my internal class
suddendly doing something else?) simplexml will horrible fail in this
case.
Derick
--
Derick Rethans
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org