Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47719 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60304 invoked from network); 1 Apr 2010 20:06:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Apr 2010 20:06:29 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 63.205.162.117 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.117 us-mr1.zend.com Received: from [63.205.162.117] ([63.205.162.117:42521] helo=us-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/73-44965-3CCF4BB4 for ; Thu, 01 Apr 2010 15:06:28 -0500 Received: from us-gw1.zend.com (us-ex1.zend.net [192.168.16.5]) by us-mr1.zend.com (Postfix) with ESMTP id 3E4B743CF0 for ; Thu, 1 Apr 2010 13:05:29 -0700 (PDT) Received: from [192.168.16.93] ([192.168.16.93]) by us-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 1 Apr 2010 13:06:24 -0700 Message-ID: <4BB4FCC0.3010301@zend.com> Date: Thu, 01 Apr 2010 13:06:24 -0700 Organization: Zend Technologies User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b1 Thunderbird/3.0.4 MIME-Version: 1.0 CC: internals References: <4BB4EC2F.1020502@smashlabs.com> <4BB4F16B.7020402@zend.com> <4BB4F50D.9090006@zend.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------060700030506000905040907" X-OriginalArrivalTime: 01 Apr 2010 20:06:24.0054 (UTC) FILETIME=[CDDD9D60:01CAD1D6] Subject: Re: [PHP-DEV] On constructors: BC Break and Class compiler Improvements From: stas@zend.com (Stanislav Malyshev) --------------060700030506000905040907 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi! The patch is simple: see attached. Doesn't break any tests except for ns_063 which specifically tests for this particular case. Any objections to having this in 5.3? -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com --------------060700030506000905040907 Content-Type: text/plain; name="nsctor.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="nsctor.diff" Index: zend_compile.c =================================================================== --- zend_compile.c (revision 297301) +++ zend_compile.c (working copy) @@ -1270,22 +1270,13 @@ } } } else { - char *short_class_name; - int short_class_name_length; - char *short_class_lcname; - - if ((short_class_name = zend_memrchr(CG(active_class_entry)->name, '\\', CG(active_class_entry)->name_length))) { - short_class_name_length = CG(active_class_entry)->name_length - (short_class_name - CG(active_class_entry)->name) - 1; - ++short_class_name; - } else { - short_class_name = CG(active_class_entry)->name; - short_class_name_length = CG(active_class_entry)->name_length; - } - short_class_lcname = do_alloca(short_class_name_length + 1, use_heap); - zend_str_tolower_copy(short_class_lcname, short_class_name, short_class_name_length); + char *class_lcname; + + class_lcname = do_alloca(CG(active_class_entry)->name_length + 1, use_heap); + zend_str_tolower_copy(class_lcname, CG(active_class_entry)->name, CG(active_class_entry)->name_length); /* Improve after RC: cache the lowercase class name */ - if ((short_class_name_length == name_len) && (!memcmp(short_class_lcname, lcname, name_len))) { + if ((CG(active_class_entry)->name_length == name_len) && (!memcmp(class_lcname, lcname, name_len))) { if (CG(active_class_entry)->constructor) { zend_error(E_STRICT, "Redefining already defined constructor for class %s", CG(active_class_entry)->name); } else { @@ -1338,7 +1329,7 @@ } else if (!(fn_flags & ZEND_ACC_STATIC)) { CG(active_op_array)->fn_flags |= ZEND_ACC_ALLOW_STATIC; } - free_alloca(short_class_lcname, use_heap); + free_alloca(class_lcname, use_heap); } efree(lcname); --------------060700030506000905040907--