From: nikhil dot gupta at in dot ibm dot com Operating system: linux, windows PHP version: 5.2CVS-2007-10-18 (snap) PHP Bug Type: Compile Warning Bug description: Warning message is missing with shuffle() more than one argument
Description: ------------ When shuffle() function is called with two arguments (ie. one argument more than expected), it performs the operation of shuffling and donot throws warning message stating for more than expected number of arguments , as we see with other functions like end() etc. Also when shuffle() is called with zero argument(ie. one less than minimum number of argument required) the warning message is not proper and do not say anything about the insufficient number of arguments. The following can be added in the beginning of the function definition for PHP5 to check for the above scenarios: if (ZEND_NUM_ARGS() != 1) { WRONG_PARAM_COUNT; } Reproduce code: --------------- <?php $arr = array(1,2,3,4,5); var_dump( shuffle() ); var_dump( shuffle($arr, 2) ); ?> Expected result: ---------------- Warning: Wrong parameter count for shuffle() in %s on line %d NULL Warning: Wrong parameter count for shuffle() in %s on line %d NULL Actual result: -------------- Warning: shuffle(): could not obtain parameters for parsing in %s on line %d bool(false) bool(true) -- Edit bug report at http://bugs.php.net/?id=43020&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43020&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43020&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43020&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43020&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43020&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43020&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43020&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43020&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43020&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43020&r=support Expected behavior: http://bugs.php.net/fix.php?id=43020&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43020&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43020&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43020&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43020&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43020&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43020&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43020&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43020&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43020&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43020&r=mysqlcfg