#27340 [Opn->Csd]: mismatched a return value between func_num_args and count(func_get_args())
| From: | sniper@php.net | Date: | Sat, 21 Feb 2004 08:07:32 +0000 |
| Subject: | #27340 [Opn->Csd]: mismatched a return value between func_num_args and count(func_get_args()) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-55273@lists.php.net to get a copy of this message | ||
ID: 27340
Updated by: sniper@php.net
Reported By: yippeei2 at nate dot com
-Status: Open
+Status: Closed
Bug Type: Unknown/Other Function
Operating System: Windows XP/2003
PHP Version: 4.3.4
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-02-21 02:11:20] yippeei2 at nate dot com
Description:
------------
func_num_args is return a value arguments count.
count(func_get_args()) is same as func_num_args.
but when certain function has two arguments, an below result mismatched
between func_num_args and count(func_get_args()).
when numbers of arguments are 2, this bug is caused.
above bug is caused on PHP5.0b4 too.
Reproduce code:
---------------
<?php
function certain_func(){
$args = func_get_args();
$argsCount = func_num_args();
echo "func_num_args() returns $argsCount\n";
echo "count(func_get_args()) returns ".count($args)."\n";
echo "below list is an item of \$args :\n";
print_r($args);
echo "\n";
}
certain_func('one', 'two');
certain_func('one', 'two', 'three');
?>
Expected result:
----------------
func_num_args() returns 2
count(func_get_args()) retruns 3
below list is an item of $args :
Array ( [0] => one [1] => two [2] => )
func_num_args() returns 3
count(func_get_args()) retruns 3
below list is an item of $args :
Array ( [0] => one [1] => two [2] => three)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27340&edit=1