Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32609 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95323 invoked by uid 1010); 3 Oct 2007 19:46:52 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 95308 invoked from network); 3 Oct 2007 19:46:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Oct 2007 19:46:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 38.99.98.18 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 38.99.98.18 beast.bluga.net Linux 2.6 Received: from [38.99.98.18] ([38.99.98.18:40917] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F8/8F-09129-9A1F3074 for ; Wed, 03 Oct 2007 15:46:50 -0400 Received: from mail.bluga.net (localhost.localdomain [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id C22DEC0E169; Wed, 3 Oct 2007 12:46:46 -0700 (MST) Received: from [129.93.238.195] (pcp094244pcs.unl.edu [129.93.238.195]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id 83E3CC0E165; Wed, 3 Oct 2007 12:46:45 -0700 (MST) Message-ID: <4703F1A1.6020906@chiaraquartet.net> Date: Wed, 03 Oct 2007 14:46:41 -0500 User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 To: php-dev , Benjamin Schulz , Stanislav Malyshev X-Enigmail-Version: 0.95.3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: a way to fix the import issue From: greg@chiaraquartet.net (Greg Beaver) Hi all, Benjamin has in fact unearthed a bug in the implementation of import. This code: should in fact be implicitly importing Blah::Exception as if it were Foo::Exception, rather than as ::Exception. In other words, I would actually expect the above code to be equivalent to: This is a simple fix. http://lxr.php.net/source/ZendEngine2/zend_compile.c#5122 should be using zend_do_build_namespace_name() with CG(current_namespace) to retrieve the actual classname to import, rather than just the last part after ::. With this change, the example code above would work without conflicting with either the built-in exception or Foo::Exception unless Foo::Exception is included from another file, which would give the correct error. I'm afraid I don't have time for a proper patch right now, but it is a very simple fix, we would just need to add a few lines to put the classname zval and CG(current_namespace) into znodes and pass to zend_do_build_namespace_name(), then extract the created zval for name. Greg