php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27340 mismatched a return value between func_num_args and count(func_get_args())
Submitted: 2004-02-21 02:11 UTC Modified: 2004-02-21 03:07 UTC
From: yippeei2 at nate dot com Assigned:
Status: Closed Package: *General Issues
PHP Version: 4.3.4 OS: Windows XP/2003
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: yippeei2 at nate dot com
New email:
PHP Version: OS:

 

 [2004-02-21 02:11 UTC] 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)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-21 03:07 UTC] sniper@php.net
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.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 19:01:36 2025 UTC