Commit:    5e9377ebd57f419de7b421878df540795ace01ef
Author:    Xinchen Hui <larue...@php.net>         Tue, 26 Mar 2013 11:44:57 
+0800
Parents:   e9f996c00d5cb6448dac1457dd9dae320c16904f
Branches:  PHP-5.4

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=5e9377ebd57f419de7b421878df540795ace01ef

Log:
Fixed bug #64515 (Memoryleak when using the same variablename 2times in 
function declaration)

Bugs:
https://bugs.php.net/64515

Changed paths:
  M  NEWS
  A  Zend/tests/bug64515.phpt
  M  Zend/zend_vm_def.h
  M  Zend/zend_vm_execute.h


Diff:
diff --git a/NEWS b/NEWS
index c14ea1c..010b8f1 100644
--- 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
index 0000000..d056c74
--- /dev/null
+++ b/Zend/tests/bug64515.phpt
@@ -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--
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index ffa94a1..3934752 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -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();
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 1860a0f..81d3688 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -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();


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to