]> granicus.if.org Git - php/commitdiff
Fixed bug #30080 (Passing array or non array of objects)
authorDmitry Stogov <dmitry@php.net>
Fri, 3 Jun 2005 15:02:49 +0000 (15:02 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 3 Jun 2005 15:02:49 +0000 (15:02 +0000)
Zend/tests/bug30080.phpt [new file with mode: 0755]
Zend/zend_compile.c

diff --git a/Zend/tests/bug30080.phpt b/Zend/tests/bug30080.phpt
new file mode 100755 (executable)
index 0000000..bd8401e
--- /dev/null
@@ -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) {
+  }
+}
index d2afe43b6bd1a150b8a13d6f4cfe983863d83bbd..31cded48c51c1d94e186eb78c2cc4b2897425509 100644 (file)
@@ -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;