]> granicus.if.org Git - php/commitdiff
- If the called method is static then don't define $this
authorAndi Gutmans <andi@php.net>
Tue, 16 Mar 2004 14:49:52 +0000 (14:49 +0000)
committerAndi Gutmans <andi@php.net>
Tue, 16 Mar 2004 14:49:52 +0000 (14:49 +0000)
Zend/zend_execute_API.c

index 937d7fad8bda7417bd725a95cfdec587ca206250..ec7a182f92091f3cb6ae5dbca5514fe0b14e20fe 100644 (file)
@@ -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;