From:             joern dot berkefeld at bittubes dot com
Operating system: -
PHP version:      Irrelevant
Package:          *General Issues
Bug Type:         Feature/Change Request
Bug description:array_rand returns differ - should always be an array

Description:
------------
---
>From manual page: http://www.php.net/function.array-rand
---

>From the manual:
"If you are picking only one entry, array_rand() returns the key for a
random 
entry. Otherwise, it returns an array of keys for the random entries"

That causes problems as this functionality is unexpected. Functions should
always 
return the same type (or false / null for failure)

Expected result:
----------------
get an array regardless of the number of results

Actual result:
--------------
the function returns an integer for one result and an array for multiple
results

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

Reply via email to