com php-src: Fix array/object cast of refcounted tmp var: Zend/tests/double_array_cast.phpt Zend/zend_vm_def .h Zend/zend_vm_execute.h
| From: | Nikita Popov | Date: | Mon, 13 Oct 2014 13:31:59 +0000 |
| Subject: | com php-src: Fix array/object cast of refcounted tmp var: Zend/tests/double_array_cast.phpt Zend/zend_vm_def .h Zend/zend_vm_execute.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82264@lists.php.net to get a copy of this message | ||
Commit: e62edf2e58c31349498b3dcedd44b64d8fb1837f
Author: Nikita Popov <nikic@php.net> Mon, 13 Oct 2014 14:51:53 +0200
Parents: 2622cfc2fbc1e088d83307d94c55b45acccfce53
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e62edf2e58c31349498b3dcedd44b64d8fb1837f
Log:
Fix array/object cast of refcounted tmp var
Changed paths:
A Zend/tests/double_array_cast.phpt
M Zend/zend_vm_def.h
M Zend/zend_vm_execute.h
Diff:
diff --git a/Zend/tests/double_array_cast.phpt b/Zend/tests/double_array_cast.phpt
new file mode 100644
index 0000000..aaee8cd
--- /dev/null
+++ b/Zend/tests/double_array_cast.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Double array cast
+--FILE--
+<?php
+
+$array = [1, 2, $x = 3];
+var_dump((array) (array) $array);
+
+?>
+--EXPECT--
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 983029f..a98e82d 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -4043,7 +4043,7 @@ ZEND_VM_HANDLER(21, ZEND_CAST, CONST|TMP|VAR|CV, ANY)
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
- FREE_OP1();
+ FREE_OP1_IF_VAR();
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index e18c730..2acd9f9 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -9695,7 +9695,6 @@ static int ZEND_FASTCALL ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
}
- zval_ptr_dtor_nogc(free_op1.var);
CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}