CodeIgniter4: Bug: [Parser] NumberFormatter::setAttribute Passing null to parameter #2 ($value) of type int|float is deprecated

PHP Version

8.0

CodeIgniter4 Version

4.3.1

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

cli-server (PHP built-in webserver)

Database

MariaDB 10.4.24

What happened?

Using the service::render with { price|local_currency(eur,nl_NL) } is not working, the fraction option cannot be set and doesn’t accept null value.

Error NumberFormatter::setAttribute(): Passing null to parameter #2 ($value) of type int|float is deprecated

Steps to Reproduce

Render view with { price|local_currency(eur,nl_NL) } as option.

Expected Output

Be able to set the fraction like { price|local_currency(eur,2,nl_NL) }

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 20 (11 by maintainers)

Most upvoted comments

Ah, it seems the following code worked, but it is still a misuse.

$render = Services::parser( '\App\Modules\ModuleName' );

Because the $viewPath is the directory, not a namespace. https://github.com/codeigniter4/CodeIgniter4/blob/29c31173b6ecdd3be75ea69b3f5eb876e7b5dcbe/system/View/View.php#L44-L48

Good to hear.

As you say, the following is not documented.

$render = Services::parser('/path/to/Views');
$render = Services::renderer('/path/to/Views');

It seems better to be documented in the user guide.

Thank you for reporting. I sent a PR: #7157