Skip to content

setlocale() can take as argument 0 and NULL #351

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

Merged
merged 2 commits into from
Oct 21, 2020

Conversation

peter-gribanov
Copy link
Contributor

https://www.php.net/manual/en/function.setlocale.php

If locale is NULL or the empty string "", the locale names will be set from the values of environment variables with the same names as the above categories, or from "LANG".
If locale is "0", the locale setting is not affected, only the current setting is returned.

@ondrejmirtes
Copy link
Member

Is it supposed to be integer 0 or string "0"?

@peter-gribanov
Copy link
Contributor Author

Is a integer, not a string.

@peter-gribanov
Copy link
Contributor Author

peter-gribanov commented Oct 19, 2020

No, though. Wait. It seems i'm wrong.

@peter-gribanov
Copy link
Contributor Author

It is not obvious to me from the documentation which data type should be used. Integer is most commonly used. It's not obvious to me in the source either. Both options work the same way.

@ondrejmirtes
Copy link
Member

Yeah, these functions are weird, the documentation talks about string only though. I'd accept a PR that changes the type to string|null.

@peter-gribanov
Copy link
Contributor Author

@ondrejmirtes please review

@ondrejmirtes ondrejmirtes merged commit 912e66b into phpstan:master Oct 21, 2020
@ondrejmirtes
Copy link
Member

Thank you!

@peter-gribanov peter-gribanov deleted the setlocale branch October 21, 2020 15:33
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

Successfully merging this pull request may close these issues.

None yet

2 participants