Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12272 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8676 invoked by uid 1010); 19 Aug 2004 20:51:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 8407 invoked from network); 19 Aug 2004 20:51:55 -0000 Received: from unknown (HELO mail.zend.com) (80.74.107.235) by pb1.pair.com with SMTP; 19 Aug 2004 20:51:55 -0000 Received: (qmail 19869 invoked from network); 19 Aug 2004 20:51:53 -0000 Received: from localhost (HELO AndiNotebook.zend.com) (127.0.0.1) by localhost with SMTP; 19 Aug 2004 20:51:53 -0000 Message-ID: <5.1.0.14.2.20040819134840.0373aac0@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Thu, 19 Aug 2004 13:51:50 -0700 To: Alan Knowles ,internals@lists.php.net In-Reply-To: <4124A40A.3000302@akbkhome.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] BC fix for __call definition. (Bug #29716) + pear bug #2136 From: andi@zend.com (Andi Gutmans) References: <4124A40A.3000302@akbkhome.com> I actually don't think it's the right approach. ext/overload has always been experimental and it doesn't make sense to start putting such a hack into the engine. You can easily change the code to use conditional includes and therefore, your PHP 4 version won't be compiled under PHP 5. Do you know how many PEAR classes are actually affected by this? Andi At 08:58 PM 8/19/2004 +0800, Alan Knowles wrote: >Attached (hopefully) should be a fix for bug #29716, allowing 3 arguments >for __call, but emitting a E_STRICT error. > >This is needed to enable simple BC wrappers to be written for code wanting >to use overload in PHP4. > >BTW: Notes on current CVS > >flex 2.5.31 currently reports >flex: fatal internal error, bad line in skeleton file >flex 2.5.4: works OK (debian package flex-old) > >/ext/standard/unserializer.c needs touching, otherwise re2c tries to >generate it (and fails here) > >Zeev/Andi could you OK it?, marcus is ok with the principle (although he >hasnt seen the code) > >Regards >Alan > > > >? fix_29716.txt >? nestfix.diff >Index: zend_compile.c >=================================================================== >RCS file: /repository/ZendEngine2/zend_compile.c,v >retrieving revision 1.578 >diff -u -r1.578 zend_compile.c >--- zend_compile.c 15 Aug 2004 15:48:32 -0000 1.578 >+++ zend_compile.c 19 Aug 2004 12:44:40 -0000 >@@ -1113,8 +1113,14 @@ > zend_error(E_COMPILE_ERROR, "Method %s::%s() must > take exactly 1 argument", CG(active_class_entry)->name, ZEND_GET_FUNC_NAME); > } else if (name_len == sizeof(ZEND_SET_FUNC_NAME) - 1 && > !memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)) && > CG(active_op_array)->num_args != 2) { > zend_error(E_COMPILE_ERROR, "Method %s::%s() must > take exactly 2 arguments", CG(active_class_entry)->name, ZEND_SET_FUNC_NAME); >- } else if (name_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && >!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)) && >CG(active_op_array)->num_args != 2) { >- zend_error(E_COMPILE_ERROR, "Method %s::%s() must >take exactly 2 arguments", CG(active_class_entry)->name, ZEND_CALL_FUNC_NAME); >+ } else if (name_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && >!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME))) { >+ /* we allow 3 arguments to enable BC wrappers for >PHP4 __call() */ >+ int num_args = CG(active_op_array)->num_args; >+ if ((num_args != 2) && (num_args != 3)) { >+ zend_error(E_COMPILE_ERROR, "Method >%s::%s() must take exactly 2 arguments", CG(active_class_entry)->name, >ZEND_CALL_FUNC_NAME); >+ } else if (num_args == 3) { >+ zend_error(E_STRICT, "Method %s::%s() >should take exactly 2 arguments", CG(active_class_entry)->name, >ZEND_CALL_FUNC_NAME); >+ } > } > } else { > if (name_len == sizeof(ZEND_AUTOLOAD_FUNC_NAME) - 1 && > !memcmp(lcname, ZEND_AUTOLOAD_FUNC_NAME, sizeof(ZEND_AUTOLOAD_FUNC_NAME)) > && CG(active_op_array)->num_args != 1) { > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php