ID: 48385 User updated by: karsten at typo3 dot org Reported By: karsten at typo3 dot org Status: Bogus Bug Type: SPL related Operating System: * PHP Version: 5.3.0RC2 New Comment:
Thanks for the hint. Although, this is not at all intuitive! Oh, well... :) Previous Comments: ------------------------------------------------------------------------ [2009-05-25 17:06:19] col...@php.net 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(); ... ------------------------------------------------------------------------ [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