php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #66750 The function `array_slice` does not do what it must to do
Submitted: 2014-02-21 12:00 UTC Modified: 2014-02-21 15:48 UTC
From: olarmariusalex at gmail dot com Assigned:
Status: Wont fix Package: Arrays related
PHP Version: 5.4.25 OS: Linux Mint
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: olarmariusalex at gmail dot com
New email:
PHP Version: OS:

 

 [2014-02-21 12:00 UTC] olarmariusalex at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.array-slice
---

The function `array_slice` just have to `Extract a slice of the array`, and must not change the array data(keys or values). Because of the default parameter value `$preserve_keys = false`, this bug appears. To resolve this issue the default parameter value must be: `$preserve_keys = true`.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-02-21 15:48 UTC] nikic@php.net
-Status: Open +Status: Wont fix -Type: Bug +Type: Feature/Change Request -Package: *General Issues +Package: Arrays related
 [2014-02-21 15:48 UTC] nikic@php.net
We won't be changing the default value of $preserve_keys. That would just be a pointless BC break. If you want the keys to be preserved, just set it...
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Apr 10 14:01:24 2021 UTC