Skip to content
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

vsprintf(): Argument #2 ($values) must be of type array, null given #52

Open
djlimix opened this issue Apr 27, 2021 · 3 comments
Open

Comments

@djlimix
Copy link

djlimix commented Apr 27, 2021

When using _s() function, it fails when you do not provide third parametre, $args.

Error message:

vsprintf(): Argument #2 ($values) must be of type array, null given

Example code:

$diff = $created->diff($now)->days;
return $diff . ' ' . _s('{0} 0 day|]1,4[ days|]4,Inf[ days', $diff)

Laravel version: 8.39.0
PHP version: 8.0
LaravelGetText version: dev-master (also tried it on 8.0.2)

However, when I add the third parametre, even only an empty array, it works.

@redalpha01
Copy link

Not a fix but I suggest providing an empty array until this is fixed.

@redalpha01
Copy link

The offending line is 112 in helpers where it defaults to null instead of empty array.

@djlimix
Copy link
Author

djlimix commented Apr 28, 2021

Not a fix but I suggest providing an empty array until this is fixed.

I am providing an empty array, I just wanted to report this.

fchalal pushed a commit to mediactive-digital/laravel-gettext that referenced this issue Sep 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants