From: Dmitry Stogov Date: Fri, 25 Jul 2008 09:44:47 +0000 (+0000) Subject: Fixed support for static methods X-Git-Tag: php-5.3.0alpha1~125 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac68c41f8d2fca9c6d94b642063f37317cc73b50;p=php Fixed support for static methods --- diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c index edaa31e30f..38d2947944 100755 --- a/ext/pdo/pdo_stmt.c +++ b/ext/pdo/pdo_stmt.c @@ -860,7 +860,7 @@ static int make_callable_ex(pdo_stmt_t *stmt, zval *callable, zend_fcall_info * fcc->initialized = 1; fcc->function_handler = function_handler; fcc->calling_scope = EG(scope); - fcc->called_scope = Z_OBJCE_PP(object); + fcc->called_scope = object ? Z_OBJCE_PP(object) : NULL; fcc->object_pp = object; return 1; diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index c8c4b084e0..44b81cd1c3 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2382,7 +2382,7 @@ ZEND_METHOD(reflection_method, invoke) */ if (mptr->common.fn_flags & ZEND_ACC_STATIC) { object_pp = NULL; - obj_ce = NULL; + obj_ce = mptr->common.scope; } else { if (Z_TYPE_PP(params[0]) != IS_OBJECT) { efree(params); @@ -2416,7 +2416,7 @@ ZEND_METHOD(reflection_method, invoke) fcc.initialized = 1; fcc.function_handler = mptr; fcc.calling_scope = obj_ce; - fcc.called_scope = Z_OBJCE_PP(object_pp); + fcc.called_scope = obj_ce; fcc.object_pp = object_pp; result = zend_call_function(&fci, &fcc TSRMLS_CC); @@ -2491,7 +2491,7 @@ ZEND_METHOD(reflection_method, invokeArgs) */ if (mptr->common.fn_flags & ZEND_ACC_STATIC) { object = NULL; - obj_ce = NULL; + obj_ce = mptr->common.scope; } else { if (!object) { efree(params); @@ -2523,8 +2523,8 @@ ZEND_METHOD(reflection_method, invokeArgs) fcc.initialized = 1; fcc.function_handler = mptr; fcc.calling_scope = obj_ce; - fcc.called_scope = Z_OBJCE_P(object); - fcc.object_pp = &object; + fcc.called_scope = obj_ce; + fcc.object_pp = object ? &object : NULL; result = zend_call_function(&fci, &fcc TSRMLS_CC);