#49889 [NEW]: offsetExists wrong result
| From: | carmen at helderhosting dot nl | Date: | Thu, 15 Oct 2009 12:31:08 +0000 |
| Subject: | #49889 [NEW]: offsetExists wrong result | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-143590@lists.php.net to get a copy of this message | ||
From: carmen at helderhosting dot nl
Operating system: unix
PHP version: 5.3.0
PHP Bug Type: SPL related
Bug description: offsetExists wrong result
Description:
------------
If $o = new ArrayObject(); $o['x'] = null;
the result for isset($o['x']) it should be false, instead true is given
Reproduce code:
---------------
<?php
$a = array();
$a['x'] = null;
var_dump(isset($a['x']));
var_dump(empty($a['x']));
var_dump(array_key_exists('x', $a));
$o = new ArrayObject();
$o['x'] = null;
var_dump($o->offsetExists('x'));
var_dump(isset($o['x']));
var_dump(empty($o['x']));
var_dump(array_key_exists('x', $o));
?>
Expected result:
----------------
bool(false)
bool(true)
bool(true)
bool(true)
bool(false)
bool(true)
bool(true)
Actual result:
--------------
bool(false)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
--
Edit bug report at http://bugs.php.net/?id=49889&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49889&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49889&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49889&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=49889&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49889&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=49889&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=49889&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=49889&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=49889&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=49889&r=support
Expected behavior: http://bugs.php.net/fix.php?id=49889&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=49889&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=49889&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=49889&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49889&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49889&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=49889&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=49889&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=49889&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=49889&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=49889&r=mysqlcfg