Bug #62903 [Opn->Nab]: array_slice ignores preserve_keys with no length
| From: | aharvey@php.net | Date: | Thu, 23 Aug 2012 06:56:26 +0000 |
| Subject: | Bug #62903 [Opn->Nab]: array_slice ignores preserve_keys with no length | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-172820@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62903&edit=1
ID: 62903
Updated by: aharvey@php.net
Reported by: php at nobswolf dot info
Summary: array_slice ignores preserve_keys with no length
-Status: Open
+Status: Not a bug
Type: Bug
Package: Arrays related
Operating System: windows
PHP Version: 5.3.16
Block user comment: N
Private report: N
New Comment:
Not a bug, per the first comment.
Previous Comments:
------------------------------------------------------------------------
[2012-08-23 06:53:32] reeze dot xia at gmail dot com
I don't get it. could you please supply full test script.
Look at this. perserver_keys works.
http://3v4l.org/hCVAv#v524
and #4168 was marked at fixed.
Do I missing something?
------------------------------------------------------------------------
[2012-08-23 06:52:26] php at nobswolf dot info
no its not...
the problem is a later array_merge, which does not have the option of preserve_keys
my fault, sorry
maybe every "reorder"-function should have this option
------------------------------------------------------------------------
[2012-08-23 06:18:54] php at nobswolf dot info
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 this bug report at https://bugs.php.net/bug.php?id=62903&edit=1