COM/VARIANT objects can have a default integer value when casted in an
integer context.

--Wez.

----- Original Message ----- 
From: "Andi Gutmans" <[EMAIL PROTECTED]>
To: "Sara Golemon" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, June 22, 2004 7:02 PM
Subject: Re: [PHP-DEV] Bug 28879: Populating arrays with resources and
objects as offsets


> This isn't a bug fix, but the behavior we chose.
> Basically only integers and strings are supported as array offsets.
> As you guessed, we converted doubles and bools to integers (possibly
> loosing info in doubles).
> As resources is something abstract, I'm not really sure we should "fix"
> this. Then again, it probably can't do much harm.
> Objects can't be converted to integers because two different objects can
> have the same object id! I mentioned it a few times on this list.
>
> Andi
>
> At 09:41 AM 6/22/2004 -0700, Sara Golemon wrote:
> >http://bugs.php.net/28879
> >
> >The fixes are really simple (and the ZE1 branch is no more complicated),
but
> >I just wanted to double check that this kind of behavior change should be
> >done.  On the one hand it makes things consistent (which is good), on the
> >other hand the two "problems" it "solves" are fairly insipid to begin
with.
> >Would this raise a BC issue?
> >
> >Andi/Zeev?
> >
> >Index: Zend/zend_execute.c
> >===================================================================
> >RCS file: /repository/ZendEngine2/zend_execute.c,v
> >retrieving revision 1.649
> >diff -u -r1.649 zend_execute.c
> >--- Zend/zend_execute.c 18 Jun 2004 18:33:46 -0000      1.649
> >+++ Zend/zend_execute.c 22 Jun 2004 16:38:27 -0000
> >@@ -3391,6 +3391,7 @@
> >                         case IS_DOUBLE:
> >
> >zend_hash_index_update(array_ptr->value.ht, (long) offset->value.dval,
> >&expr_ptr, sizeof(zval *), NULL);
> >                                 break;
> >+                       case IS_RESOURCE:
> >                         case IS_LONG:
> >                         case IS_BOOL:
> >
> >zend_hash_index_update(array_ptr->value.ht, offset->value.lval,
> >&expr_ptr, sizeof(zval *), NULL);
> >@@ -3402,6 +3403,7 @@
> >                                 zend_hash_update(array_ptr->value.ht,
"",
> > sizeof(""), &expr_ptr,
> >sizeof(zval *), NULL);
> >                                 break;
> >                         default:
> >+                               zend_error(E_WARNING, "Illegal offset
type");
> >                                 zval_ptr_dtor(&expr_ptr);
> >                                 /* do nothing */
> >                                 break;
> >
> >--
> >PHP Internals - PHP Runtime Development Mailing List
> >To unsubscribe, visit: http://www.php.net/unsub.php
>
> -- 
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to