ID:               48385
 Updated by:       col...@php.net
 Reported By:      karsten at typo3 dot org
-Status:           Open
+Status:           Bogus
 Bug Type:         SPL related
 Operating System: *
 PHP Version:      5.3.0RC2
 New Comment:

This is expected, current/reset/key... is supposed to work on arrays,
and not on objects even if they implement the ArrayAccess interface.

Use $o->rewind(); $o->current(); ...


Previous Comments:
------------------------------------------------------------------------

[2009-05-25 14:54:15] karsten at typo3 dot org

Description:
------------
When using current on an SplObjectStorage instance I'd expect
(according 
to the documentation) to get the current object back. Instead I get
back 
false.

Reproduce code:
---------------
<?php
$s = new SplObjectStorage();
$o = new stdClass();
$s->attach($o);
reset($s);
var_dump(current($s));
?>

Expected result:
----------------
object(stdClass)#2 (0) {
}


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



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48385&edit=1

Reply via email to