Re: BC break: $o= new stdclass; empty($o)
| From: | Andi Gutmans | Date: | Thu, 04 Mar 2004 12:10:10 +0000 |
| Subject: | Re: BC break: $o= new stdclass; empty($o) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-8370@lists.php.net to get a copy of this message | ||
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