php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28822 ArrayObject::offsetExists() works inverted
Submitted: 2004-06-18 02:32 UTC Modified: 2004-06-21 21:15 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: nospam0 at malkusch dot de Assigned: helly (profile)
Status: Closed Package: Arrays related
PHP Version: 5.0.0RC3 OS: *
Private report: No CVE-ID: None
 [2004-06-18 02:32 UTC] nospam0 at malkusch dot de
Description:
------------
Hi 
IMO offsetExists() should return true, if a key exists and 
false if not. But it does it inverted. 

Reproduce code:
---------------
$array = new ArrayObject();
$array->offsetSet('key', 'value');
var_dump($array->offsetExists('key'));
var_dump($array->offsetExists('nokey'));

Expected result:
----------------
bool(true) bool(false) 

Actual result:
--------------
bool(false) bool(true) 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-21 21:15 UTC] helly@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 14:01:29 2024 UTC