cvs: ZendEngine2(PHP_5_0) / zend_execute.h /tests bug34199.phpt php-src NEWS

From: Date: Tue, 13 Sep 2005 06:10:39 +0000
Subject: cvs: ZendEngine2(PHP_5_0) / zend_execute.h /tests bug34199.phpt php-src NEWS
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-4119@lists.php.net to get a copy of this message
dmitry Tue Sep 13 02:10:39 2005 EDT Added files: (Branch: PHP_5_0) /ZendEngine2/tests bug34199.phpt Modified files: /php-src NEWS /ZendEngine2 zend_execute.h Log: Fixed bug #34199 (if($obj)/if(!$obj) inconsistency because of cast handler) http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.477&r2=1.1760.2.478&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1760.2.477 php-src/NEWS:1.1760.2.478 --- php-src/NEWS:1.1760.2.477 Mon Sep 12 04:26:04 2005 +++ php-src/NEWS Tue Sep 13 02:10:34 2005 @@ -2,6 +2,8 @@ ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? ????, PHP 5.0.6 - Fixed bug #34449 (ext/soap: XSD_ANYXML functionality not exposed). (Dmitry) +- Fixed bug #34199 (if($obj)/if(!$obj) inconsistency because of cast handler). + (Dmitry, Alex) 05 Sep 2005, PHP 5.0.5 - Upgraded PCRE library to version 5.0. (Andrei) http://cvs.php.net/diff.php/ZendEngine2/zend_execute.h?r1=1.72.2.1&r2=1.72.2.2&ty=u Index: ZendEngine2/zend_execute.h diff -u ZendEngine2/zend_execute.h:1.72.2.1 ZendEngine2/zend_execute.h:1.72.2.2 --- ZendEngine2/zend_execute.h:1.72.2.1 Sun Apr 24 10:49:00 2005 +++ ZendEngine2/zend_execute.h Tue Sep 13 02:10:38 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute.h,v 1.72.2.1 2005/04/24 14:49:00 sniper Exp $ */ +/* $Id: zend_execute.h,v 1.72.2.2 2005/09/13 06:10:38 dmitry Exp $ */ #ifndef ZEND_EXECUTE_H #define ZEND_EXECUTE_H @@ -96,6 +96,24 @@ case IS_OBJECT: if(IS_ZEND_STD_OBJECT(*op)) { TSRMLS_FETCH(); + + if (Z_OBJ_HT_P(op)->cast_object) { + zval tmp; + if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_BOOL, 1 TSRMLS_CC) == SUCCESS) { + result = Z_LVAL(tmp); + break; + } + } else if (Z_OBJ_HT_P(op)->get) { + zval *tmp = Z_OBJ_HT_P(op)->get(op TSRMLS_CC); + if(Z_TYPE_P(tmp) != IS_OBJECT) { + /* for safety - avoid loop */ + convert_to_boolean(tmp); + result = Z_LVAL_P(tmp); + zval_ptr_dtor(&tmp); + break; + } + } + if(EG(ze1_compatibility_mode)) { result = (zend_hash_num_elements(Z_OBJPROP_P(op))?1:0); } else { http://cvs.php.net/co.php/ZendEngine2/tests/bug34199.phpt?r=1.1&p=1 Index: ZendEngine2/tests/bug34199.phpt +++ ZendEngine2/tests/bug34199.phpt --TEST-- Bug #34199 (if($obj)/if(!$obj) inconsistency because of cast handler) --SKIPIF-- <?php if (!extension_loaded("simplexml")) print "skip"; ?> --FILE-- <?php $xml = "<root></root>"; $xml = simplexml_load_string($xml); $kids = $xml->children(); var_dump((bool)$kids); if($kids) echo "bug\n"; else echo "ok\n"; if(!$kids) echo "ok\n"; else echo "bug\n"; ?> --EXPECT-- bool(false) ok ok

« previous php.zend-engine.cvs (#4119) next »