com php-src: Fix bug #70179 ($this refcount issue): NEWS Zend/tests/bug70179.phpt Zend/zend_vm_def.h Zend/zend _vm_execute.h

From: Date: Sat, 01 Aug 2015 18:35:56 +0000
Subject: com php-src: Fix bug #70179 ($this refcount issue): NEWS Zend/tests/bug70179.phpt Zend/zend_vm_def.h Zend/zend _vm_execute.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-88262@lists.php.net to get a copy of this message
Commit: 2d6f0e4584375c90a895fed4074d579f364aa347 Author: Bob Weinand <bobwei9@hotmail.com> Sat, 1 Aug 2015 20:35:56 +0200 Parents: 351b4e8015a45de1abb64bc5acd77ae0d7fbe92d Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2d6f0e4584375c90a895fed4074d579f364aa347 Log: Fix bug #70179 ($this refcount issue) Bugs: https://bugs.php.net/70179 Changed paths: M NEWS A Zend/tests/bug70179.phpt M Zend/zend_vm_def.h M Zend/zend_vm_execute.h Diff: diff --git a/NEWS b/NEWS index 39a4b62..5ad8082 100644 --- a/NEWS +++ b/NEWS @@ -11,8 +11,9 @@ PHP NEWS . Fixed bug #70106 (Inheritance by anonymous class). (Bob) . Fixed bug #69674 (SIGSEGV array.c:953). (cmb) . Fixed bug #70164 (__COMPILER_HALT_OFFSET__ under namespace is not defined). - (Bob)) - . Fixed Bug #70108 (sometimes empty $_SERVER['QUERY_STRING']). (Anatol) + (Bob) + . Fixed bug #70108 (sometimes empty $_SERVER['QUERY_STRING']). (Anatol) + . Fixed bug #70179 ($this refcount issue). (Bob) - Curl: . Fixed bug #70163 (curl_setopt_array() type confusion). (Laruence) diff --git a/Zend/tests/bug70179.phpt b/Zend/tests/bug70179.phpt new file mode 100644 index 0000000..a5bdb98 --- /dev/null +++ b/Zend/tests/bug70179.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #70179 ($this refcount issue) +--FILE-- +<?php + +class X { + function __invoke() { + var_dump($this); + } +} +(new X)(); + +?> +--EXPECT-- +object(X)#1 (0) { +} diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index f77e495..8537a6a 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3250,6 +3250,9 @@ ZEND_VM_C_LABEL(try_function_name): ZEND_ASSERT(GC_TYPE(fbc->common.prototype) == IS_OBJECT); GC_REFCOUNT(fbc->common.prototype)++; call_info |= ZEND_CALL_CLOSURE; + } else { + call_info |= ZEND_CALL_RELEASE_THIS; + GC_REFCOUNT(object)++; /* For $this pointer */ } FREE_OP2(); } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) && diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 950353c..527de7d 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -2019,6 +2019,9 @@ try_function_name: ZEND_ASSERT(GC_TYPE(fbc->common.prototype) == IS_OBJECT); GC_REFCOUNT(fbc->common.prototype)++; call_info |= ZEND_CALL_CLOSURE; + } else { + call_info |= ZEND_CALL_RELEASE_THIS; + GC_REFCOUNT(object)++; /* For $this pointer */ } } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) && @@ -2438,6 +2441,9 @@ try_function_name: ZEND_ASSERT(GC_TYPE(fbc->common.prototype) == IS_OBJECT); GC_REFCOUNT(fbc->common.prototype)++; call_info |= ZEND_CALL_CLOSURE; + } else { + call_info |= ZEND_CALL_RELEASE_THIS; + GC_REFCOUNT(object)++; /* For $this pointer */ } } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) && @@ -2690,6 +2696,9 @@ try_function_name: ZEND_ASSERT(GC_TYPE(fbc->common.prototype) == IS_OBJECT); GC_REFCOUNT(fbc->common.prototype)++; call_info |= ZEND_CALL_CLOSURE; + } else { + call_info |= ZEND_CALL_RELEASE_THIS; + GC_REFCOUNT(object)++; /* For $this pointer */ } zval_ptr_dtor_nogc(free_op2); } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&

« previous php.cvs (#88262) next »