Re: BC break with callbacks in 5.3

From: Date: Wed, 30 Jan 2008 12:56:51 +0000
Subject: Re: BC break with callbacks in 5.3
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-35019@lists.php.net to get a copy of this message
Hi, If you could rename IS_CALLABLE_CHECK_NO_ACCESS too that would be great, at first glance I expected it to check access on the callback. In reality its to skip the access check, so might be worth checking from a clarity point of view. IS_CALLABLE_SKIP_ACCESS_CHECK or IS_CALLABLE_ACCESS_CHECK_SKIP. Scott Etienne Kneuss wrote:
Hi, I planned to do some various callbacks related cleanups on 5_3. If that's ok with you, I'll come with a patch within the following days that should fix various issues, including your patch if still necessary. Regards On Jan 30, 2008 11:48 AM, Scott MacVicar <scottmac@php.net> wrote:
Hi all, Static callbacks behave differently between 5.2 and 5.3, I recently noticed this when trying to install PEAR, it printed a warning each time call_user_func and call_user_func_array was used. After some tracking down it seems like the callback option for zend_parse_parameters was backported from 6 but the strict check was left as is. <?php class MyClass { function test($var) { echo "$var\n"; } } MyClass::Test('regular'); call_user_func(array('MyClass', 'test'), 'callback'); ?> The prints E_STRICT errors in PHP 5.2 but in 5.3 you get a single E_STRICT error followed by a warning for call_user_func. You can resolve this by adding the static keyword to the method declaration but regardless it's inconsistent as stands. I think the strict flag needs to be removed for 5.3. Patch is attached to resolve the issue. Scott Index: ZendEngine2/zend_API.c =================================================================== RCS file: /repository/ZendEngine2/zend_API.c,v retrieving revision 1.296.2.27.2.34.2.17 diff -u -r1.296.2.27.2.34.2.17 zend_API.c
--- ZendEngine2/zend_API.c      24 Jan 2008 10:49:26 -0000      1.296.2.27.2.34.2.17
+++ ZendEngine2/zend_API.c      30 Jan 2008 10:37:45 -0000
@@ -2568,7 +2568,7 @@
        zend_function *func;
        zval **obj;
-       if (!zend_is_callable_ex(callable, IS_CALLABLE_STRICT, callable_name, NULL, &ce, &func, &obj TSRMLS_CC)) {
+       if (!zend_is_callable_ex(callable, 0, callable_name, NULL, &ce, &func, &obj TSRMLS_CC)) {
                return FAILURE;
        }
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.internals (#35019) next »