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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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: Wed Apr 24 23:01:34 2024 UTC