Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33724 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35694 invoked by uid 1010); 5 Dec 2007 09:25:33 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 35679 invoked from network); 5 Dec 2007 09:25:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Dec 2007 09:25:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from [212.25.124.162] ([212.25.124.162:22631] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/62-20707-A8E66574 for ; Wed, 05 Dec 2007 04:25:33 -0500 Received: (qmail 15617 invoked from network); 5 Dec 2007 09:25:24 -0000 Received: from internal.zend.office (HELO ?127.0.0.1?) (10.1.1.1) by internal.zend.office with SMTP; 5 Dec 2007 09:25:24 -0000 Message-ID: <47566E80.7020402@zend.com> Date: Wed, 05 Dec 2007 12:25:20 +0300 User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Derick Rethans CC: Gregory Beaver , PHP Developers Mailing List References: <4755E492.2080906@chiaraquartet.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: RFC: Dropping Namespace From: dmitry@zend.com (Dmitry Stogov) I don't understand what are you going to demonstrate with this example. Did you try to run it? It produces error as expected. DOMDocument() in your example is a user-space class that is not related to internal ext/dom class. If you like to use internal class that is overriden in namespace you can use ::DomDocument instead. The "use DomDocument as test;" is useless from my point of view. You always may override internal classes in namespaces. Thanks. Dmitry. Derick Rethans wrote: > 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: > > namespace blah; > use DomDocument as test; > > class DOMDocument { } > > $dom = new DOMDocument; // > $dom->loadXML('blah'); > $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 >