Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25247 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10089 invoked by uid 1010); 8 Aug 2006 19:00:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 10074 invoked from network); 8 Aug 2006 19:00:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2006 19:00:39 -0000 X-PHP-List-Original-Sender: php-php-dev@m.gmane.org X-Host-Fingerprint: 80.91.229.2 main.gmane.org Linux 2.5 (sometimes 2.4) (4) Received: from ([80.91.229.2:46525] helo=ciao.gmane.org) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 0C/72-13488-45FD8D44 for ; Tue, 08 Aug 2006 15:00:37 -0400 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GAWo3-0007yf-Ku for internals@lists.php.net; Tue, 08 Aug 2006 21:00:00 +0200 Received: from bos-nat1.smarterliving.net ([65.112.23.131]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Aug 2006 20:59:59 +0200 Received: from rabbitt by bos-nat1.smarterliving.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 08 Aug 2006 20:59:59 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: internals@lists.php.net Date: Tue, 08 Aug 2006 14:58:51 -0400 Lines: 37 Message-ID: Reply-To: rabbitt@xaraya.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: bos-nat1.smarterliving.net User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) Sender: news Subject: [PATCH] User defined Error Handler's unable to include() class definitions in error handler functions From: rabbitt@xaraya.com ("Carl P. Corliss") Hi all :-) Please forgive my intrusion - I just wanted to submit this patch for a what others and I believe might be a bug . Basically, this patch fixes a problem where, if a class emits an error during declaration (ie: after active_class_entry is set in the function zend_do_begin_class_declaration but before it is nulled in function zend_do_end_class_declaration), and the user defined error handler function include()'s or require()'s a file containing another class definition, then the compiler will error out with an error stating "Class declarations may not be nested." For example code, see bug #35634 (http://bugs.php.net/bug.php?id=35634). The code in the example provided by the bug shows that the class ErrorClass is technically declared globally within the scope of the class TestClass as TestClass is being parsed during the E_STRICT emit. But the new class really *is* being declared within the scope of the error handler function which is the one including the 'errorClass' file. However, due to the fact that the error triggered happens during the class declaration, active_class_entry is still set, and thus, when the class being included within the user defined error handler is parsed, it finds that active_class_entry is already set (to TestClass), so instead of emitting the E_STRICT, it now emits an E_COMPILE_ERROR when it shouldn't. This patch makes a change to zend.c:zend_error() such that, *just prior* to calling a user defined error handler, it will store the value of active_class_entry in a temporary variable, and then NULL it, make the call to the error handler, and then restore the value of active_class_entry. Thank you for your time. :-) Cheers!, -- Carl P. Corliss (aka Rabbitt)