#36613 [NEW]: array_slice Cannot Preserve Keys without Length

From: Date: Sat, 04 Mar 2006 20:27:48 +0000
Subject: #36613 [NEW]: array_slice Cannot Preserve Keys without Length
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93914@lists.php.net to get a copy of this message
From: lists at zaunere dot com Operating system: Windows PHP version: 5.1.2 PHP Bug Type: Feature/Change Request Bug description: array_slice Cannot Preserve Keys without Length Description: ------------ The optional fourth parameter preserve_keys is only available if the third parameter length is also supplied. If the developer wishes to set preserve_keys to TRUE, he must also supply the length of the array he wishes to have returned, which may not be known. There is no way to indicate that length should remain optional - like passing NULL - while providing a value for preserve_keys. Reproduce code: --------------- $SomeArray = array('First','Middle','Last'); var_dump(array_slice($SomeArray,1,NULL,TRUE)); Expected result: ---------------- array(2) { [1]=> string(6) "Middle" [2]=> string(4) "Last" } Actual result: -------------- array(0) { } -- Edit bug report at http://bugs.php.net/?id=36613&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36613&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36613&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36613&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36613&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36613&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36613&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36613&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36613&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36613&r=support Expected behavior: http://bugs.php.net/fix.php?id=36613&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36613&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36613&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36613&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36613&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36613&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36613&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36613&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36613&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36613&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36613&r=mysqlcfg

« previous php.bugs (#93914) next »