summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2005-06-03 15:02:49 +0000
committerDmitry Stogov <dmitry@php.net>2005-06-03 15:02:49 +0000
commit89e53d5ab231b64163d7908aa0259019f439b1c9 (patch)
treea34f5701116efba1793792115201e55f4ab203c9
parent6b39b374ef5f2711ca2bfa63f1982c4026ff2397 (diff)
downloadphp-git-89e53d5ab231b64163d7908aa0259019f439b1c9.tar.gz
Fixed bug #30080 (Passing array or non array of objects)
-rwxr-xr-xZend/tests/bug30080.phpt18
-rw-r--r--Zend/zend_compile.c3
2 files changed, 20 insertions, 1 deletions
diff --git a/Zend/tests/bug30080.phpt b/Zend/tests/bug30080.phpt
new file mode 100755
index 0000000000..bd8401e1be
--- /dev/null
+++ b/Zend/tests/bug30080.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #30080 (Passing array or non array of objects)
+--FILE--
+<?php
+class foo {
+ function foo($arrayobj) {
+ var_dump($arrayobj);
+ }
+}
+
+new foo(array(new stdClass));
+?>
+--EXPECT--
+array(1) {
+ [0]=>
+ object(stdClass)#2 (0) {
+ }
+}
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index d2afe43b6b..31cded48c5 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -972,7 +972,8 @@ void zend_do_free(znode *op1 TSRMLS_DC)
* Find JMP_NO_CTOR, mark the preceding ASSIGN and the
* proceeding INIT_FCALL_BY_NAME as unused
*/
- if (opline->opcode == ZEND_JMP_NO_CTOR) {
+ if (opline->opcode == ZEND_JMP_NO_CTOR &&
+ opline->op1.u.var == op1->u.var) {
opline->op1.u.EA.type |= EXT_TYPE_UNUSED;
(opline-1)->result.u.EA.type |= EXT_TYPE_UNUSED;
(opline+1)->op1.u.EA.type |= EXT_TYPE_UNUSED;