cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug39017.phpt

From: Date: Tue, 03 Oct 2006 09:05:35 +0000
Subject: cvs: ZendEngine2 / zend_vm_def.h zend_vm_execute.h /tests bug39017.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-5294@lists.php.net to get a copy of this message
dmitry Tue Oct 3 09:05:35 2006 UTC Modified files: /ZendEngine2 zend_vm_def.h zend_vm_execute.h /ZendEngine2/tests bug39017.phpt Log: Fixed bug #39017 (foreach(($obj = new myClass) as $v); echo $obj; segfaults) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.146&r2=1.147&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.146 ZendEngine2/zend_vm_def.h:1.147 --- ZendEngine2/zend_vm_def.h:1.146 Tue Oct 3 07:31:10 2006 +++ ZendEngine2/zend_vm_def.h Tue Oct 3 09:05:35 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.146 2006/10/03 07:31:10 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.147 2006/10/03 09:05:35 dmitry Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -3191,6 +3191,9 @@ array_ptr = tmp; } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); + if (!ce || !ce->get_iterator) { + array_ptr->refcount++; + } } else { if (OP1_TYPE == IS_VAR && free_op1.var == NULL && http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.150&r2=1.151&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.150 ZendEngine2/zend_vm_execute.h:1.151 --- ZendEngine2/zend_vm_execute.h:1.150 Tue Oct 3 07:31:10 2006 +++ ZendEngine2/zend_vm_execute.h Tue Oct 3 09:05:35 2006 @@ -2144,6 +2144,9 @@ array_ptr = tmp; } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); + if (!ce || !ce->get_iterator) { + array_ptr->refcount++; + } } else { if (IS_CONST == IS_VAR && free_op1.var == NULL && @@ -4748,6 +4751,9 @@ array_ptr = tmp; } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); + if (!ce || !ce->get_iterator) { + array_ptr->refcount++; + } } else { if (IS_TMP_VAR == IS_VAR && free_op1.var == NULL && @@ -7949,6 +7955,9 @@ array_ptr = tmp; } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); + if (!ce || !ce->get_iterator) { + array_ptr->refcount++; + } } else { if (IS_VAR == IS_VAR && free_op1.var == NULL && @@ -20485,6 +20494,9 @@ array_ptr = tmp; } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) { ce = Z_OBJCE_P(array_ptr); + if (!ce || !ce->get_iterator) { + array_ptr->refcount++; + } } else { if (IS_CV == IS_VAR && free_op1.var == NULL && http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug39017.phpt?r1=1.1&r2=1.2&diff_format=u Index: ZendEngine2/tests/bug39017.phpt diff -u /dev/null ZendEngine2/tests/bug39017.phpt:1.2 --- /dev/null Tue Oct 3 09:05:35 2006 +++ ZendEngine2/tests/bug39017.phpt Tue Oct 3 09:05:35 2006 @@ -0,0 +1,11 @@ +--TEST-- +Bug #39017 (foreach(($obj = new myClass) as $v); echo $obj; segfaults) +--FILE-- +<?php +class A {} +foreach(($a=(object)new A()) as $v); +var_dump($a); // UNKNOWN:0 +?> +--EXPECTF-- +object(A)#%d (0) { +}

« previous php.zend-engine.cvs (#5294) next »