Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32566 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39136 invoked by uid 1010); 2 Oct 2007 19:03:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 39121 invoked from network); 2 Oct 2007 19:03:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Oct 2007 19:03:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=cellog@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=cellog@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 38.99.98.18 as permitted sender) X-PHP-List-Original-Sender: cellog@php.net X-Host-Fingerprint: 38.99.98.18 beast.bluga.net Linux 2.6 Received: from [38.99.98.18] ([38.99.98.18:58021] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2C/D3-12743-3E592074 for ; Tue, 02 Oct 2007 15:03:03 -0400 Received: from mail.bluga.net (localhost.localdomain [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id 29286C0E08C; Tue, 2 Oct 2007 12:02:55 -0700 (MST) Received: from [129.93.124.6] (pcp041067pcs.unl.edu [129.93.124.6]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id 88D73C0E08B; Tue, 2 Oct 2007 12:02:54 -0700 (MST) Message-ID: <470295DA.6090602@php.net> Date: Tue, 02 Oct 2007 14:02:50 -0500 User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: Benjamin Schulz CC: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: namespaces: import name conflicts with defined class From: cellog@php.net (Greg Beaver) Benjamin Schulz wrote: > Hi all, > > import Foo::Bar AS DomDocument; > import Foo::Exception; > import MyStuff::Dom::XsltProcessor; > > Result in a "Fatal error: Import name '...' conflicts with defined class" > Of course i want to refer to my own exception in my application or > framework as "Exception", and of course i want to use it without > prefixes (import myStuff::Exception AS MyStuffException), i wouldn't use > namespace otherwise (there is no other benefit, right?). > It's not that one accidentally puts an "import Foo::Exception" in his > file .. > > Is there a good reason for this bevhaviour that i don't see? There is > still ::Exception to access the class in the global namespace. > > regards, > Benjamin Hi Benjamin, If you are aliasing a class to the same name as an existing class, you should also import that class with another name: This is somewhat unintuitive, but is pretty simple to solve. Greg