Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39920 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 61543 invoked from network); 13 Aug 2008 14:44:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Aug 2008 14:44:36 -0000 Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 88.198.8.16 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 88.198.8.16 bigtime.backendmedia.com Linux 2.6 Received: from [88.198.8.16] ([88.198.8.16:45373] helo=bigtime.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 04/98-30462-253F2A84 for ; Wed, 13 Aug 2008 10:44:36 -0400 Received: from localhost (unknown [127.0.0.1]) by bigtime.backendmedia.com (Postfix) with ESMTP id A3D73414400A; Wed, 13 Aug 2008 14:46:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at backendmedia.com Received: from bigtime.backendmedia.com ([127.0.0.1]) by localhost (bigtime.backendmedia.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 61MOcKqM5JE3; Wed, 13 Aug 2008 16:46:18 +0200 (CEST) Received: from [192.168.80.139] (unknown [195.226.16.50]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mls@pooteeweet.org) by bigtime.backendmedia.com (Postfix) with ESMTP id 463114144006; Wed, 13 Aug 2008 16:46:16 +0200 (CEST) Cc: Marcus Boerger , Etienne Kneuss , Stanislav Malyshev , hannes.magnusson@gmail.com, internals@lists.php.net Message-ID: <66A41D6E-5CDF-4954-BF13-9ECF71038814@pooteeweet.org> To: Lars Strojny In-Reply-To: <1218634532.4926.5.camel@localhost> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v928.1) Date: Wed, 13 Aug 2008 16:42:15 +0200 References: <909776579.20080803142659@marcus-boerger.de> <840985F2-A701-4BE4-91F6-F6B39048CF9B@pooteeweet.org> <48A09FF4.1030101@zend.com> <7f3ed2c30808111411t51553771j389f05c3436bc625@mail.gmail.com> <48A0C415.9090104@zend.com> <48A0D579.2000000@zend.com> <48A0DBAE.2010401@zend.com> <496879481.20080812153636@marcus-boerger.de> <279600845.20080812225135@marcus-boerger.de> <1218621323.4926.1.camel@localhost> <1341995942.20080813152134@marcus-boerger.de> <1218634532.4926.5.camel@localhost> X-Mailer: Apple Mail (2.928.1) Subject: Re: [PHP-DEV] Inconsistencies in 5.3 From: mls@pooteeweet.org (Lukas Kahwe Smith) On 13.08.2008, at 15:35, Lars Strojny wrote: > Hi Markus > > Am Mittwoch, den 13.08.2008, 15:21 +0200 schrieb Marcus Boerger: > [...] >> Namespaces are new, so it never worked before. But yes, this would >> trigger >> a warning in the compiler which means you are told to not do this >> with apc >> or other compiler caches. > > You are aware that this is used in a number of PHP libraries/ > frameworks? > Additionally, a lot have code like this: > > class ... > public function foo() > { > if (!$this->_something) { > require_once 'Foo/Exception.php'; > throw new FooException(); > } > } Right, this is quite common. So is including drivers inside factory methods. Even if they are not explicit, there is obviously also autoload. Just so that I get straight why we are doing this: The namespace of the file is not magically applied to the included code, so instead one would expect the included code to set the relevant namespace itself. Now for any library that would use namespaces and have an include inside that namespace, it would also set a namespace in the included file or its likely a bug. Not sure if we could only throw a warning if we do an include without a namespace being defined in the file that is being included? That starts being quite fancy in terms of error handling though, which even if doable probably adds overhead? The other situation I see would be a namespaced template engine that loads some template who's content is not namespaced explicitly. It does not really make sense to start defining namespaces in templates just to get around that warning. > I guess most of the time those using OP caches know what they are > doing. > So why should a warning be triggered here? Thats a pretty big assumption. regards, Lukas Kahwe Smith mls@pooteeweet.org