#36786 [NEW]: empty() on an element of ArrayObject

From: Date: Sun, 19 Mar 2006 10:37:30 +0000
Subject: #36786 [NEW]: empty() on an element of ArrayObject
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-94553@lists.php.net to get a copy of this message
From: davd dot nqd at gmail dot com Operating system: Windows XP PHP version: 5.1.2 PHP Bug Type: SPL related Bug description: empty() on an element of ArrayObject Description: ------------ When applying empty() to an element of an ArrayObject which is the empty string, empty() returns true. But, the manual for empty() states that "an empty string" is considered empty. Note: I tried to reproduce this bug using a custom implementation of ArrayAccess which worked as expected. Reproduce code: --------------- <?php $array = array('index' => ''); $arrayObject = new ArrayObject($array); if (empty($arrayObject['index'])) { echo 'empty'; } else { echo 'not empty'; } ?> Expected result: ---------------- empty Actual result: -------------- not empty -- Edit bug report at http://bugs.php.net/?id=36786&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36786&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36786&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36786&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36786&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36786&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36786&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36786&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36786&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36786&r=support Expected behavior: http://bugs.php.net/fix.php?id=36786&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36786&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36786&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36786&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36786&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36786&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36786&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36786&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36786&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36786&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36786&r=mysqlcfg

« previous php.bugs (#94553) next »