Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8370 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82582 invoked by uid 1010); 4 Mar 2004 12:10:16 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 82558 invoked from network); 4 Mar 2004 12:10:15 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 4 Mar 2004 12:10:15 -0000 Received: (qmail 12779 invoked from network); 4 Mar 2004 12:10:13 -0000 Received: from guardian.zend.office (HELO AndiNotebook.zend.com) (10.1.1.4) by mail.zend.com with SMTP; 4 Mar 2004 12:10:13 -0000 Message-ID: <5.1.0.14.2.20040304140729.02098198@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Thu, 04 Mar 2004 14:10:10 +0200 To: Timm Friebe ,internals@lists.php.net In-Reply-To: <1078077799.1440.54.camel@localhost> References: <1078074613.1440.9.camel@localhost> <1078074613.1440.9.camel@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] BC break: $o= new stdclass; empty($o) From: andi@zend.com (Andi Gutmans) Hey, The reason for this behavior is that in PHP 3 and 4, objects were treated very much like arrays (this is the main reason for redesigning the object model for PHP 5). I don't think that the old behavior is correct and an empty should always return true (i.e. empty($var) should return true if the variable is NULL and false if $var is an object). I don't think we should by default support the PHP 4 behavior because it's just not right. What I suggest is to either break BC completely or support the old behavior in compatibility mode. What option do you prefer? Andi At 07:03 PM 2/29/2004 +0100, Timm Friebe wrote: >On Sun, 2004-02-29 at 18:10, Timm Friebe wrote: > > Hi, >[...] > > Was this an intentional change? > >zend_execute.h, lines 95 - 98: > > case IS_OBJECT: > /* OBJ-TBI */ > result = 1; > break; > >I have a patch, but that includes a TSRMLS_FETCH() - maybe it would be >wise to change: > > ZEND_API int zend_is_true(zval *op); > >to > > ZEND_API int zend_is_true(zval *op TSRMLS_DC); > >but that breaks the API. > >- Timm > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php