php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #37572 The Warning boxes for current(), prev() and next() are not precise enough.
Submitted: 2006-05-24 03:06 UTC Modified: 2006-05-29 16:05 UTC
From: phpbug-david at tulloh dot id dot au Assigned: colder (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2006-05-24 03:06 UTC] phpbug-david at tulloh dot id dot au
Description:
------------
There is a warning box on the documentation for the current() function.

It talks about the impossibility of differing between the end of the array and the value zero or "".  It is possible to use current() with these values using the === operator.

The real problem is arrays containing the value false, this isn't actually mentioned in the warning.

Further the warning suggests using each() instead of current() to get around these problems, however the two functions aren't really comparable as each() advances the array cursor.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-27 16:59 UTC] colder@php.net
The note is not completely wrong. If the array contains an element that is === false, there is no way to properly distinguish it from the beginning/end of the array.

This also affects the manual page for prev() and next().

This patch should help you a bit:
http://patches.colder.ch/prev-next-current.patch
 [2006-05-28 20:20 UTC] gavinfo@php.net
Sorry colder, I didn't realise you were already working on 
this, go ahead.
 [2006-05-29 16:05 UTC] colder@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Thanks for spotting this David.
 [2020-02-07 06:11 UTC] phpdocbot@php.net
Automatic comment on behalf of colder
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=e5de952ad1f38ba861b34637d457720f1baa3e45
Log: Fix #37572 (Return value can be false on success)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 20:01:33 2025 UTC