php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80440 base_convert doesn't take named arguments
Submitted: 2020-11-28 23:16 UTC Modified: 2020-12-28 14:20 UTC
From: zevio at dougherty dot se Assigned: cmb (profile)
Status: Closed Package: *Math Functions
PHP Version: 8.0.0 OS: Mac OS 11.0.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
48 - 40 = ?
Subscribe to this entry?

 
 [2020-11-28 23:16 UTC] zevio at dougherty dot se
Description:
------------
Named arguments do not work with base_convert.

base_convert(number: 'a37334', frombase: 16, tobase: 2) throws error.

Test script:
---------------
<?php declare(strict_types = 1);

echo base_convert(number: 'a37334', frombase: 16, tobase: 2);


Expected result:
----------------
101000110111001100110100

Actual result:
--------------
PHP Fatal error:  Uncaught Error: Unknown named parameter $number in…

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-28 23:53 UTC] cmb@php.net
Oh, they do: <https://3v4l.org/VgaFY>.  However, the documentation
is not yet up to date regarding the parameters names; we're
working on that[1].  For the time being, consider to use
reflection to retrieve the proper parameters, e.g.

    php --rf base_convert

[1] <https://github.com/php/doc-en/pulls?q=is%3Apr+is%3Aopen+label%3Amethodsynopses>
 [2020-11-28 23:54 UTC] cmb@php.net
-Type: Bug +Type: Documentation Problem
 [2020-12-28 14:20 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2020-12-28 14:20 UTC] cmb@php.net
The documentation has been updated in the meantime.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC