From:             gmblar+php at gmail dot com
Operating system: Linux
PHP version:      5.4.4
Package:          Arrays related
Bug Type:         Bug
Bug description:array_fill_keys must always return an array

Description:
------------
array_fill_keys must always return an array as described in 
http://de3.php.net/manual/en/function.array-fill-keys.php.

When call array_fill_keys with invalid arguments the function returns an
invalid 
null!

Test script:
---------------
<?php

var_dump(array_fill_keys(array('a', 'b', 'c')));
var_dump(array_fill_keys(true, 1));
var_dump(array_fill_keys('', 2));
var_dump(array_fill_keys(NULL, 3));
var_dump(array_fill_keys());



Expected result:
----------------
Warning: array_fill_keys() expects parameter 1 to be array, boolean given
in - on 
line 4
array(0) {
}

Warning: array_fill_keys() expects parameter 1 to be array, string given in
- on 
line 5
array(0) {
}

Warning: array_fill_keys() expects parameter 1 to be array, null given in -
on 
line 6
array(0) {
}

Warning: array_fill_keys() expects exactly 2 parameters, 0 given in - on
line 7
array(0) {
}


Actual result:
--------------
Warning: array_fill_keys() expects exactly 2 parameters, 1 given in - on
line 3
NULL

Warning: array_fill_keys() expects parameter 1 to be array, boolean given
in - on 
line 4
NULL

Warning: array_fill_keys() expects parameter 1 to be array, string given in
- on 
line 5
NULL

Warning: array_fill_keys() expects parameter 1 to be array, null given in -
on 
line 6
NULL

Warning: array_fill_keys() expects exactly 2 parameters, 0 given in - on
line 7
NULL


-- 
Edit bug report at https://bugs.php.net/bug.php?id=62431&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62431&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62431&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62431&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62431&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62431&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62431&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62431&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62431&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62431&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62431&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62431&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62431&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62431&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62431&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62431&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62431&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62431&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62431&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62431&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62431&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62431&r=mysqlcfg

Reply via email to