Doc #61157 [NEW]: Documentation says array_slice() resets array pointer, but it doesn't.
| From: | ben at bravenet dot com | Date: | Tue, 21 Feb 2012 19:47:00 +0000 |
| Subject: | Doc #61157 [NEW]: Documentation says array_slice() resets array pointer, but it doesn't. | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-7983@lists.php.net to get a copy of this message | ||
From:
Operating system: n/a
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:Documentation says array_slice() resets array pointer, but it doesn't.
Description:
------------
In the documentation at http://php.net/array_slice it
states:
"Note: This function will reset() the array pointer of the input array
after use."
However, a quick test shows that this is not the case.
Test script:
---------------
$array = array(1, 2, 3);
next($array); //move pointer to second position (key 1)
var_dump(current($array)); //output int(2)
$last = array_slice($array, -1); //get last element
var_dump(current($array)); //output int(2) pointer not reset!
--
Edit bug report at https://bugs.php.net/bug.php?id=61157&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61157&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61157&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61157&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=61157&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61157&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=61157&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=61157&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=61157&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=61157&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=61157&r=support
Expected behavior: https://bugs.php.net/fix.php?id=61157&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=61157&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=61157&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=61157&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61157&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61157&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=61157&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=61157&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=61157&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=61157&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=61157&r=mysqlcfg