Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:12264 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12686 invoked by uid 1010); 19 Aug 2004 12:56:17 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 12589 invoked from network); 19 Aug 2004 12:56:16 -0000 Received: from unknown (HELO newweb.akbkhome.com) (202.81.246.113) by pb1.pair.com with SMTP; 19 Aug 2004 12:56:16 -0000 Received: from develop ([192.168.0.40] ident=alan) by newweb.akbkhome.com with esmtp (Exim 4.33) id 1BxmXW-0000gy-AP for internals@lists.php.net; Thu, 19 Aug 2004 21:01:10 +0800 Message-ID: <4124A40A.3000302@akbkhome.com> Date: Thu, 19 Aug 2004 20:58:50 +0800 User-Agent: Mozilla Thunderbird 0.7.3 (X11/20040805) X-Accept-Language: en-us, en MIME-Version: 1.0 To: internals@lists.php.net Content-Type: multipart/mixed; boundary="------------050601050907070907030809" Subject: BC fix for __call definition. (Bug #29716) + pear bug #2136 From: alan@akbkhome.com (Alan Knowles) --------------050601050907070907030809 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 --------------050601050907070907030809 Content-Type: text/plain; name="fix_29716.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="fix_29716.txt" ? 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) { --------------050601050907070907030809--