ID: 40036 Updated by: [EMAIL PROTECTED] Reported By: matthew at zend dot com -Status: Open +Status: Closed Bug Type: SPL related Operating System: Debian GNU/Linux (unstable) PHP Version: 5.2.0 New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2007-01-05 18:33:00] matthew at zend dot com Description: ------------ When using the ArrayObject::ARRAY_AS_PROPS flag with ArrayObject, empty() does not work correctly on properties defined using either array notation or object notation (and not previously declared in the object). null, false, and empty strings do not return a true value from empty(). If ARRAY_AS_PROPS is not specified, empty() works fine. Reproduce code: --------------- class View extends ArrayObject { public function __construct(array $array = array()) { parent::__construct($array, ArrayObject::ARRAY_AS_PROPS); } } $view = new View(); $view->foo = false; $view->bar = null; $view->baz = ''; if (empty($view['foo']) || empty($view->foo)) { echo "View::foo empty\n"; } if (empty($view['bar']) || empty($view->bar)) { echo "View::bar empty\n"; } if (empty($view['baz']) || empty($view->baz)) { echo "View::baz empty\n"; } Expected result: ---------------- View::foo empty View::bar empty View::baz empty Actual result: -------------- No output received. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40036&edit=1