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 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

Pull Requests

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: Sun Dec 22 01:01:30 2024 UTC