diff options
| author | Dmitry Stogov <dmitry@php.net> | 2007-10-03 09:47:25 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2007-10-03 09:47:25 +0000 |
| commit | 0cd4039af2fb9a61ca489ac6e2f3f28aabf637c3 (patch) | |
| tree | 86b6ae9d4e514a6c102a7b878aff50c27270cc6d /Zend | |
| parent | c7047381f5ca559f617d95eaa708e01d133cb276 (diff) | |
| download | php-git-0cd4039af2fb9a61ca489ac6e2f3f28aabf637c3.tar.gz | |
Fixed bug #42818 ($foo = clone(array()); leaks memory)
Diffstat (limited to 'Zend')
| -rw-r--r-- | Zend/tests/bug42818.phpt | 9 | ||||
| -rw-r--r-- | Zend/zend_vm_def.h | 2 | ||||
| -rw-r--r-- | Zend/zend_vm_execute.h | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/Zend/tests/bug42818.phpt b/Zend/tests/bug42818.phpt new file mode 100644 index 0000000000..a1d79a41e5 --- /dev/null +++ b/Zend/tests/bug42818.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #42818 ($foo = clone(array()); leaks memory) +--FILE-- +<?php +$foo = clone(array()); +?> +--EXPECTF-- +Warning: __clone method called on non-object in %sbug42818.php on line 2 + diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 6405b09436..39235dba7b 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -2534,7 +2534,7 @@ ZEND_VM_HANDLER(110, ZEND_CLONE, CONST|TMP|VAR|UNUSED|CV, ANY) zend_error(E_WARNING, "__clone method called on non-object"); EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); EX_T(opline->result.u.var).var.ptr->refcount++; - FREE_OP1_IF_VAR(); + FREE_OP1(); ZEND_VM_NEXT_OPCODE(); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 3ec65b0e3c..2caa1db50e 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -4415,7 +4415,7 @@ static int ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS) zend_error(E_WARNING, "__clone method called on non-object"); EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr); EX_T(opline->result.u.var).var.ptr->refcount++; - + zval_dtor(free_op1.var); ZEND_VM_NEXT_OPCODE(); } |
