Doc #62595 [Opn->Csd]: array_slice documentation error

From: Date: Wed, 18 Jul 2012 11:33:44 +0000
Subject: Doc #62595 [Opn->Csd]: array_slice documentation error
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8567@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62595&edit=1 ID: 62595 Updated by: nikic@php.net Reported by: theanomaly dot is at gmail dot com Summary: array_slice documentation error -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2012-07-18 11:24:20] theanomaly dot is at gmail dot com Description: ------------ The documentation for array_slice currently states that "Note: This function will reset() the array pointer of the input array after use.", which is not true. After having reviewed the source and confirmed with a test I'm submitting a patch to remove this note from the docs. Below I've provided a test script to prove that this behavior is non-existent. I also have a patch from edit.php.net to remove this note. Thanks. Test script: --------------- <?php $array = array(1,2,3,4); /* This should produce int(2) */ var_dump(next($array)); $slice = array_slice($array, -1); /* This should still produce int(2) */ var_dump(current($array)); $slice = array_slice($array, 2, 1); /* This should still produce int(2) */ var_dump(current($array)); /* This proves the array's internal pointer was never changed by array_slice() */ Expected result: ---------------- int(2) int(1) int(1) Actual result: -------------- int(2) int(2) int(2) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62595&edit=1

« previous php.doc.bugs (#8567) next »