Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10714 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15967 invoked by uid 1010); 22 Jun 2004 17:02:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 15862 invoked from network); 22 Jun 2004 17:02:50 -0000 Received: from unknown (HELO mail.zend.com) (80.74.107.235) by pb1.pair.com with SMTP; 22 Jun 2004 17:02:50 -0000 Received: (qmail 15725 invoked from network); 22 Jun 2004 17:02:48 -0000 Received: from localhost (HELO AndiNotebook.zend.com) (127.0.0.1) by localhost with SMTP; 22 Jun 2004 17:02:48 -0000 Message-ID: <5.1.0.14.2.20040622180046.02e53768@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Tue, 22 Jun 2004 18:02:44 +0100 To: "Sara Golemon" ,internals@lists.php.net In-Reply-To: <20040622164209.23239.qmail@pb1.pair.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] Bug 28879: Populating arrays with resources and objects as offsets From: andi@zend.com (Andi Gutmans) References: <20040622164209.23239.qmail@pb1.pair.com> 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