Doc #80477 [Opn->Csd]: 2nd argument should be count not num
| From: | cmb@php.net | Date: | Fri, 04 Dec 2020 00:36:49 +0000 |
| Subject: | Doc #80477 [Opn->Csd]: 2nd argument should be count not num | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18195@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80477&edit=1
ID: 80477
Updated by: cmb@php.net
Reported by: guillaume dot olivrin at protonmail dot com
Summary: 2nd argument should be count not num
-Status: Open
+Status: Closed
Type: Documentation Problem
Package: Unknown/Other Function
Operating System: Windows 10 Pro
PHP Version: 8.0.0
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Fixed with <http://svn.php.net/viewvc?view=revision&revision=351860>.
Previous Comments:
------------------------------------------------------------------------
[2020-12-03 09:05:25] kocsismate@php.net
Currently, the manual is not exactly up-to-date with PHP 8.0 changes. This project is in progress,
and quite a few extensions already has the correct signatures (see the closed PRs): https://github.com/php/doc-en/pulls?q=is%3Apr+is%3Aopen+label%3Amethodsynopses
I quickly submitted a PR to fix the array signatures as well.
------------------------------------------------------------------------
[2020-12-03 08:59:48] kocsismate@php.net
The following pull request has been associated:
Patch Name: Generate array methodsynopses based on stubs
On GitHub: https://github.com/php/doc-en/pull/266
Patch: https://github.com/php/doc-en/pull/266.patch
------------------------------------------------------------------------
[2020-12-03 08:39:23] guillaume dot olivrin at protonmail dot com
Reproduce bug:
https://3v4l.org/b5k6W
See fix:
https://3v4l.org/pSqN6
------------------------------------------------------------------------
[2020-12-03 08:33:33] guillaume dot olivrin at protonmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=80477&edit=1