Edit report at https://bugs.php.net/bug.php?id=60338&edit=1
ID: 60338 Comment by: g...@php.net Reported by: g...@php.net Summary: SplFixedArray::key returns index for invalid keys Status: Open Type: Bug Package: SPL related PHP Version: 5.4SVN-2011-11-19 (SVN) Block user comment: N Private report: N New Comment: Apparently the Expected Output is achieved when using key() instead of SplFixedArray::key(). See http://codepad.viper-7.com/I3REjD. Thanks to NikiC for pointing it out. Previous Comments: ------------------------------------------------------------------------ [2011-11-19 13:32:44] g...@php.net Description: ------------ SplFixedArray::key() will return a value even when the key does not exist in the SplFixedArray. This does not conform to the behavior we have in regular arrays, ArrayObject and ArrayIterator. SplFixedArray::key() should return NULL when the current key does not exist to conform. Test script: --------------- http://codepad.viper-7.com/4hWmUn Expected result: ---------------- NULL NULL NULL NULL Actual result: -------------- int(3) NULL NULL NULL ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60338&edit=1