Bug #80971 [NEW]: func_get_args() didnt work when using named args

From: Date: Tue, 20 Apr 2021 16:38:26 +0000
Subject: Bug #80971 [NEW]: func_get_args() didnt work when using named args
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233530@lists.php.net to get a copy of this message
From:             antoni at friki dot cat
Operating system: 
PHP version:      8.0.3
Package:          *General Issues
Bug Type:         Bug
Bug description:func_get_args() didnt work when using named args

Description:
------------
func_get_args() in combination with named args returns an empty array.

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

function foo(...$args) {
    //var_dump($args);
    var_dump(func_get_args());
}

foo(a: 9, b: 99, c: 999);


Expected result:
----------------
I expected an array with 3 elements.

Probably:
array(3) {
  ["a"]=>
  int(9)
  ["b"]=>
  int(99)
  ["c"]=>
  int(999)
}

Or:
array(3) {
  [0]=>
  int(9)
  [1]=>
  int(99)
  [2]=>
  int(999)
}

Actual result:
--------------
array(0) {
}

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


Thread (1 message)

  • antoni at friki dot cat
« previous php.bugs (#233530) next »