Doc #80477 [NEW]: 2nd argument should be count not num
| From: | guillaume dot olivrin at protonmail dot com | Date: | Thu, 03 Dec 2020 08:33:33 +0000 |
| Subject: | Doc #80477 [NEW]: 2nd argument should be count not num | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-18180@lists.php.net to get a copy of this message | ||
From: guillaume dot olivrin at protonmail dot com
Operating system: Windows 10 Pro
PHP version: 8.0.0
Package: Unknown/Other Function
Bug Type: Documentation Problem
Bug description:2nd argument should be count not num
Description:
------------
---
From manual page: https://php.net/function.array-fill
---
I tried PHP8 new functionnality 'named arguments' with this example
below taken from a presentation but it didn't work.
> array_fill(start_index: 2, num: 3, value: 'PHP8')
--> Fatal error: Uncaught Error: Unknown named parameter $num in Command
line code:1
The documentation says :
> array_fill ( int $start_index , int $num , mixed $value ) : array
I used the following to get the argument name from my PHP8 :
> $reflx = new ReflectionFunction('array_fill');
print_r($reflx->getParameters());
--> count
I suggest a change in the documentation.
Test script:
---------------
Bug:
array_fill(start_index: 2, num: 3, value: 'PHP8')
Fixed:
array_fill(start_index: 2, count: 3, value: 'PHP8')
Expected result:
----------------
array(3) {
[2]=>
string(4) "PHP8"
[3]=>
string(4) "PHP8"
[4]=>
string(4) "PHP8"
}
Actual result:
--------------
Fatal error: Uncaught Error: Unknown named parameter $num in Command
line code:1
Stack trace:
#0 {main}
thrown in Command line code on line 1
--
Edit bug report at https://bugs.php.net/bug.php?id=80477&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80477&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80477&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80477&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80477&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80477&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80477&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80477&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80477&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80477&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80477&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80477&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80477&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80477&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80477&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80477&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80477&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80477&r=mysqlcfg