Doc #62804 [NEW]: array_slice(): Undocumented huge difference in behavior of across 5.2.4
| From: | matteosistisette at gmail dot com | Date: | Sun, 12 Aug 2012 20:06:33 +0000 |
| Subject: | Doc #62804 [NEW]: array_slice(): Undocumented huge difference in behavior of across 5.2.4 | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-8732@lists.php.net to get a copy of this message | ||
From: matteosistisette at gmail dot com
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:array_slice(): Undocumented huge difference in behavior of across 5.2.4
Description:
------------
---
From manual page: http://www.php.net/function.array-slice#refsect1-
function.array-slice-description
---
array array_slice ( array $array , int $offset [, int $length = NULL [,
bool
$preserve_keys = false ]] )
That the default value of the $length parameter is NULL is true only for
php
>=5.2.4
Prior to that version, passing NULL is NOT the same as omitting it.
Check this: http://3v4l.org/gW4pG
Note the difference in output between 5.2.3 and 5.2.4
Only starting from 5.2.4 it is as documented.
This has a TREMENDOUS impact and must be documented with a gigantic red
warning.
Instead, it is not even mentioned.
The sentence "If it is omitted, then the sequence will have everything from
offset up until the end of the array." _is_ correct for all version, but if
one
needs to specify the $preserve_keys parameter without specifying $length,
one
needs to pass the default value (that's why it's very relevant), and the
value
has changed.
--
Edit bug report at https://bugs.php.net/bug.php?id=62804&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62804&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62804&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62804&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62804&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62804&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62804&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62804&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62804&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62804&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62804&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62804&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62804&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62804&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62804&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62804&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62804&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62804&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62804&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62804&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62804&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62804&r=mysqlcfg