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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 08:01:28 2024 UTC