diff options
Diffstat (limited to 'Zend/zend_interfaces.c')
| -rwxr-xr-x | Zend/zend_interfaces.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index 96ef70f21f..10c4a356e1 100755 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -84,7 +84,15 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend fcic.function_handler = *fn_proxy; } fcic.calling_scope = obj_ce; - fcic.called_scope = object_pp ? obj_ce : EG(called_scope); + if (object_pp) { + fcic.called_scope = Z_OBJCE_PP(object_pp); + } else if (obj_ce && + !(EG(called_scope) && + instanceof_function(EG(called_scope), obj_ce TSRMLS_CC))) { + fcic.called_scope = obj_ce; + } else { + fcic.called_scope = EG(called_scope); + } fcic.object_ptr = object_pp ? *object_pp : NULL; result = zend_call_function(&fci, &fcic TSRMLS_CC); } |
