From: Andi Gutmans Date: Tue, 16 Mar 2004 14:49:52 +0000 (+0000) Subject: - If the called method is static then don't define $this X-Git-Tag: php-5.0.0RC1RC2~32 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=833b97d4c2997744c34dc06980ea53a807713451;p=php - If the called method is static then don't define $this --- diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 937d7fad8b..ec7a182f92 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -776,18 +776,22 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS current_this = EG(This); if (fci->object_pp) { - EG(This) = *fci->object_pp; + if ((EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) { + EG(This) = NULL; + } else { + EG(This) = *fci->object_pp; - if (!PZVAL_IS_REF(EG(This))) { - EG(This)->refcount++; /* For $this pointer */ - } else { - zval *this_ptr; + if (!PZVAL_IS_REF(EG(This))) { + EG(This)->refcount++; /* For $this pointer */ + } else { + zval *this_ptr; - ALLOC_ZVAL(this_ptr); - *this_ptr = *EG(This); - INIT_PZVAL(this_ptr); - zval_copy_ctor(this_ptr); - EG(This) = this_ptr; + ALLOC_ZVAL(this_ptr); + *this_ptr = *EG(This); + INIT_PZVAL(this_ptr); + zval_copy_ctor(this_ptr); + EG(This) = this_ptr; + } } } else { EG(This) = NULL;