Bug #62903 [NEW]: array_slice ignores preserve_keys with no length
| From: | php at nobswolf dot info | Date: | Thu, 23 Aug 2012 06:18:54 +0000 |
| Subject: | Bug #62903 [NEW]: array_slice ignores preserve_keys with no length | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-172815@lists.php.net to get a copy of this message | ||
From: php at nobswolf dot info
Operating system: windows
PHP version: 5.3.16
Package: Arrays related
Bug Type: Bug
Bug description:array_slice ignores preserve_keys with no length
Description:
------------
I want to slice an array into a first one with the first 3 entries
and a second one with the rest (variable length).
Test script:
---------------
$wertA2 = array_slice ($wertA, 0, 3, true);
$wertA3 = array_slice ($wertA, 3, null, true);
Expected result:
----------------
I need preserved keys even when I can not give a length.
Actual result:
--------------
The preserve_keys = true gets ignored and keys a get renumbered :-(
see also #41686
This bug is 5 years old. When will it get fixed?
--
Edit bug report at https://bugs.php.net/bug.php?id=62903&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62903&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62903&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62903&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=62903&r=fixed
Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62903&r=needdocs
Fixed in release: https://bugs.php.net/fix.php?id=62903&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=62903&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=62903&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=62903&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=62903&r=support
Expected behavior: https://bugs.php.net/fix.php?id=62903&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=62903&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=62903&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=62903&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62903&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=62903&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=62903&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=62903&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=62903&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=62903&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=62903&r=mysqlcfg