From 695d12d0db2a7403c29fba2f07e1b6f817381def Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 3 Jun 2005 15:02:09 +0000 Subject: [PATCH] Fixed bug #30080 (Passing array or non array of objects) --- NEWS | 1 + Zend/tests/bug30080.phpt | 18 ++++++++++++++++++ Zend/zend_compile.c | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100755 Zend/tests/bug30080.phpt diff --git a/NEWS b/NEWS index 71f3621068..0edb943636 100644 --- a/NEWS +++ b/NEWS @@ -129,6 +129,7 @@ PHP NEWS (Dmitry) - Fixed bug #30126 (Enhancement for error message for abstract classes). (Marcus) +- Fixed bug #30080 (Passing array or non array of objects). (Dmitry) - Fixed bug #29975 (memory leaks when set_error_handler() is used inside error handler). (Tony) - Fixed bug #29971 (variables_order behaviour). (Dmitry) 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-- + +--EXPECT-- +array(1) { + [0]=> + object(stdClass)#2 (0) { + } +} diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 81f117bed4..99d5a39886 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -898,7 +898,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; -- 2.50.1