#40882 [NEW]: Ãrray_fill doesn't support negative start index

From: Date: Wed, 21 Mar 2007 16:00:31 +0000
Subject: #40882 [NEW]: Ãrray_fill doesn't support negative start index
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110661@lists.php.net to get a copy of this message
From:             guile_spam at laposte dot net
Operating system: Linux ~~~~ 2.6.12-12mdk #1 F
PHP version:      5.2.1
PHP Bug Type:     Arrays related
Bug description:  Ãrray_fill doesn't support negative start index

Description:
------------
the function "array_fill" doesn't support correctly a negative number as
first parameter.
If start_index is negative, then it starts with the correct value, but the
next key value is always 0.

I guess could have the answer in the bug 24159...
Maybe the documentation have to be updated, or (I hope it will be this
solution) the function array_fill have to fixed :-P

Thx for all!

Reproduce code:
---------------
<?php

print_r(array_fill(-3,5,0));

?>



Expected result:
----------------
Array
(
    [-3] => 0
    [-2] => 0
    [-1] => 0
    [0] => 0
    [1] => 0
)

Actual result:
--------------
Array
(
    [-3] => 0
    [0] => 0
    [1] => 0
    [2] => 0
    [3] => 0
)

-- 
Edit bug report at http://bugs.php.net/?id=40882&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40882&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40882&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40882&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40882&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=40882&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40882&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40882&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40882&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40882&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40882&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=40882&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=40882&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40882&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40882&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40882&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40882&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40882&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40882&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40882&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40882&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#110661) next »