Fixed bug #30080 (Passing array or non array of objects)

This commit is contained in:
Dmitry Stogov 2005-06-03 15:02:49 +00:00
parent 6b39b374ef
commit 89e53d5ab2
2 changed files with 20 additions and 1 deletions

18
Zend/tests/bug30080.phpt Executable file
View File

@ -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) {
}
}

View 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;