From:             acallaha at connect dot carleton dot ca
Operating system: Fedora
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  offsetGet() returns a VALUE, given a KEY

Description:
------------
ArrayObject::offsetGet() does NOT return the value corresponding to a
given index as documented, but actually requires a key (NOT an int $index)
as input and returns a value given this key. This was determined through
testing.

Reproduce code:
---------------
A sample array:

$array_3=array("this"=>"0", "is"=>"1", "life"=> "hello");

$array_3_obj = new ArrayObject($array_3);

print $array_3_obj->offsetGet(2);



Expected result:
----------------
hello

Actual result:
--------------
PHP Notice:  Undefined offset:  2 

-- 
Edit bug report at http://bugs.php.net/?id=41682&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41682&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41682&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41682&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41682&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41682&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41682&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41682&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41682&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41682&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41682&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41682&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41682&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41682&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41682&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41682&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41682&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41682&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41682&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41682&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41682&r=mysqlcfg

Reply via email to