]> granicus.if.org Git - php/commitdiff
Fixed bug #64515 (Memoryleak when using the same variablename 2times in function...
authorXinchen Hui <laruence@php.net>
Tue, 26 Mar 2013 03:44:57 +0000 (11:44 +0800)
committerXinchen Hui <laruence@php.net>
Tue, 26 Mar 2013 03:44:57 +0000 (11:44 +0800)
NEWS
Zend/tests/bug64515.phpt [new file with mode: 0644]
Zend/zend_vm_def.h
Zend/zend_vm_execute.h

diff --git a/NEWS b/NEWS
index c14ea1cc873368b811922b5c20504d1a0e3b9ae0..010b8f11aba80d46040a848dcff39e2208fec9a5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2013, PHP 5.4.14
 - Core
+  . Fixed bug #64515 (Memoryleak when using the same variablename 2times in
+    function declaration). (Laruence)
   . Fixed bug #64432 (more empty delimiter warning in strX methods). (Laruence)
   . Fixed bug #64417 (ArrayAccess::&offsetGet() in a trait causes fatal error).
     (Dmitry)
diff --git a/Zend/tests/bug64515.phpt b/Zend/tests/bug64515.phpt
new file mode 100644 (file)
index 0000000..d056c74
--- /dev/null
@@ -0,0 +1,10 @@
+--TEST--
+Bug #64515 (Memoryleak when using the same variablename 2times in function declaration)
+--FILE--
+<?php
+function foo($unused = null, $unused = null, $arg = array()) {
+           return 1;
+}
+foo();
+?>
+--EXPECT--
index ffa94a18625da73d65d1e8ff83dc992e8ba65d53..393475259eb7c102c52207b6665886cebb2a4ba7 100644 (file)
@@ -3234,7 +3234,7 @@ ZEND_VM_HANDLER(64, ZEND_RECV_INIT, ANY, CONST)
 
        zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
        var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->result.var TSRMLS_CC);
-       Z_DELREF_PP(var_ptr);
+       zval_ptr_dtor(var_ptr);
        *var_ptr = assignment_value;
 
        CHECK_EXCEPTION();
index 1860a0f9baa9c8c9647172d5f34651b8cdcd9198..81d368883057ec6b1c8c9928a341436b0ba91b69 100644 (file)
@@ -1374,7 +1374,7 @@ static int ZEND_FASTCALL  ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_
 
        zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value, opline->extended_value TSRMLS_CC);
        var_ptr = _get_zval_ptr_ptr_cv_BP_VAR_W(EX_CVs(), opline->result.var TSRMLS_CC);
-       Z_DELREF_PP(var_ptr);
+       zval_ptr_dtor(var_ptr);
        *var_ptr = assignment_value;
 
        CHECK_EXCEPTION();