#38240 [NEW]: Change prev() and next() documentation

From: Date: Fri, 28 Jul 2006 01:33:56 +0000
Subject: #38240 [NEW]: Change prev() and next() documentation
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969373610@lists.php.net to get a copy of this message
From: paul at stunning-stuff dot com Operating system: PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Change prev() and next() documentation Description: ------------ The documentation for prev() states the following: "Returns the array value in the previous place that's pointed to by the internal array pointer, or FALSE if there are no more elements." After reading this I was expecting prev() to only change the array pointer's position if there is a previous element and return false (without changing the pointer's position) if there isn't a previous element. This misconception caused a bug in my code and it took me quite some time to figure out the problem. I would suggest you change the text to make it less ambiguous. The next() documentation is a little more clear, but could also use some disambiguation. Bug report #37598 shows that I am not the only one who misunderstood the docs. The final paragraph in the final post in that bug report is a good explanation of how prev() and next() work: "You should check the return value of prev and next. The state is undefined as out of range. Reset the array after having reached the end or beginning." Thanks for your time and effort, Paul van der Maas -- Edit bug report at http://bugs.php.net/?id=38240&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38240&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38240&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38240&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38240&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38240&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38240&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38240&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38240&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38240&r=support Expected behavior: http://bugs.php.net/fix.php?id=38240&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38240&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38240&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38240&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38240&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38240&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38240&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38240&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38240&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38240&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38240&r=mysqlcfg

« previous php.doc (#969373610) next »