2008/2/19, Cristian Rodriguez <[EMAIL PROTECTED]>: > > There is a similar case with unset() an offset of booleans and integers. > > <?php > $foo = true: > /* should throw a fatal error, like it does when trying to unset string > offsets. > actually $foo remains unchanged after unset() (!!) > unset($foo[0]); > > Index: Zend/zend_vm_def.h > =================================================================== > RCS file: /repository/ZendEngine2/zend_vm_def.h,v > retrieving revision 1.59.2.29.2.48.2.36 > diff -u -p -r1.59.2.29.2.48.2.36 zend_vm_def.h > --- Zend/zend_vm_def.h 11 Feb 2008 15:46:10 -0000 > 1.59.2.29.2.48.2.36 > +++ Zend/zend_vm_def.h 19 Feb 2008 14:32:18 -0000 > @@ -3281,6 +3281,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR| > zend_error_noreturn(E_ERROR, "Cannot > unset string offsets"); > ZEND_VM_CONTINUE(); /* bailed out before > */ > default: > + zend_error_noreturn(E_ERROR, "Cannot > unset %s offsets", zend_get_type_by_const(Z_TYPE_PP(container))); > FREE_OP2(); > break; > }
Added! I have updated the patch, because the bool variables (used internally on foreach, list(.., ..) = each(...), for example) are passed also to zend_fetch_dimension_address_read(), what break the previous patch (default: zend_error...) Then, i think that this could be handled in zend_vm_def.h, checking for OP1_TYPE != IS_VAR when the type is boolean. Well, i don't know how the Zend Engine works properly... So, If i said anything wrong, let me know, please. Finally, this was my suggestion. http://felipe.ath.cx/diff/bug39915.diff Thanks.