-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: [Parser] NumberFormatter::setAttribute Passing null to parameter #2 ($value) of type int|float is deprecated #7156
Comments
Found the issue for my problem, the documentation is missing a third parameter, it's allowed to use the following way <!-- This works -->
{ price|local_currency(eur,nl_NL,2) }
<!-- This will throw ErrorException -->
{ price|local_currency(eur,nl_NL) } EditMissing the option to set the default view path on initialize as well, had to find out by digging to the code that it's allowed to change the view path. $render = Services::parser( $viewPath = null, $config = null, $getShared = true ); |
Thank you for reporting. |
What do you mean? |
In my case i work from a modules folder inside the app folder, example: App By default it looks at: App |
You can use Namespaced Views. But you mean you want to write code like |
I think it's a misunderstanding from my side, i'm using the https://codeigniter4.github.io/CodeIgniter4/outgoing/view_renderer.html#CodeIgniter\View\View that doesn't work with Namespaces. |
Did you define the namespace for the module?
|
Yes, these are defined in I've returned $render = Services::parsert( '\App\Modules\ModuleName' );
// With this I can use
return $render->setData(['key' => 'val'])->render('view_name'); |
I mean namespaced view is like |
This in my case wil result in a ErrorException and by default looks at // Will by default look in: App\Views\view_name.php
return $render->setData(['key' => 'val'])->render('view_name'); |
No, I mean: return $render->setData(['key' => 'val'])->render('App\Modules\ModuleName\Views\view_name'); |
That will result in the error given below:
|
@bedrijfsportaal Cannot reproduce. The following code works fine: This repository code does not work on your Windows? |
My folder structure differs from your example, but i've found the issue myself working just like you answered! |
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. |
Ah, it seems the following code worked, but it is still a misuse. $render = Services::parser( '\App\Modules\ModuleName' ); Because the CodeIgniter4/system/View/View.php Lines 44 to 48 in 29c3117
|
Ah dammit, your right totally overlooked that part... Thank you for the clearifycation, will keep this in mind for other modules! |
I found a bug that the following does not work, because the debugbar initialize the shared renderer service. $render = Services::renderer('/path/to/Views'); I sent a PR to fix #7172 |
Debugbar is disabled by default for me, so i wouldn't have noticed that, but good to hear the bug is as quickly fixed as it is found! |
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 acceptnull
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
The text was updated successfully, but these errors were encountered: