php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #39194 array_slice feature
Submitted: 2006-10-19 06:48 UTC Modified: 2008-02-18 12:15 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: oglodek dot marek at pronox dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 5.1.6 OS: linux/windows
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: oglodek dot marek at pronox dot com
New email:
PHP Version: OS:

 

 [2006-10-19 06:48 UTC] oglodek dot marek at pronox dot com
Description:
------------
there is not posibble (now) to set third(3)(length) parametr in array_slice on end of table where you using preserve_keys. Now You must write somthing like this:
array_slice($array, $offset, count($array), true);
my idea is => if length is true then set pointer at end of array:
array_slice($array, $offset, true, true);
ps: sorry for my english (i im polish:P)
best regards,
Marek Oglodek aka Tsharek (oglodek.marek@pronox.com)

Reproduce code:
---------------
line 2192 in array.c file(php 5.1.6):
	if (argc >= 3) {
		convert_to_long_ex(length);
		length_val = Z_LVAL_PP(length);
	} else {
		length_val = zend_hash_num_elements(Z_ARRVAL_PP(input));
	}


Expected result:
----------------
line 2192 in array.c file(php 5.1.6):
	if (argc >= 3 && !zend_is_true(length)) {
		convert_to_long_ex(length);
		length_val = Z_LVAL_PP(length);
	} else {
		length_val = zend_hash_num_elements(Z_ARRVAL_PP(input));
	}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-02-18 12:15 UTC] felipe@php.net
Use NULL on third parameter.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 27 13:01:30 2024 UTC