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

Pass correct type to setlocale #15961

Merged
merged 2 commits into from
Jan 11, 2022
Merged

Pass correct type to setlocale #15961

merged 2 commits into from
Jan 11, 2022

Conversation

theboxer
Copy link
Member

@theboxer theboxer commented Jan 7, 2022

What does it do?

Fixes calling setlocale. setlocale requires a string as a second argument (https://www.php.net/manual/en/function.setlocale.php). The current code passes null instead of "0" for reading the locale value - on my machine it was causing 502 Gateway Error.

Also set skipEmpty to true when getting the locale from system settings - as this setting is present and empty by default, so it was using the empty string value instead of the value obtained by calling setlocale(LC_ALL, '0').

Tested it on php 7.4, 8.0 and 8.1 (7.4 didn't have this issue, probably because it doesn't care about argument types).

Why is it needed?

I'm not 100% sure about the setup needed for this, but for some instances NGINX was returning 502 gateway error. Also I'd say it's better to pass correct arguments to functions :)

How to test

Not sure :)

Related issue(s)/PR(s)

n/a

@theboxer theboxer added bug The issue in the code or project, which should be addressed. area-core labels Jan 7, 2022
@theboxer theboxer added this to the v3.0.0-rc1 milestone Jan 7, 2022
@theboxer theboxer requested a review from opengeek January 7, 2022 14:09
@theboxer theboxer requested a review from Mark-H as a code owner January 7, 2022 14:09
@cla-bot cla-bot bot added the cla-signed CLA confirmed for contributors to this PR. label Jan 7, 2022
opengeek
opengeek previously approved these changes Jan 11, 2022
@opengeek opengeek dismissed their stale review January 11, 2022 02:55

accidentally clicked approve

@opengeek opengeek changed the title Pass correct types to setlocale Pass correct type to setlocale Jan 11, 2022
@opengeek opengeek merged commit 1c05632 into modxcms:3.x Jan 11, 2022
Mark-H added a commit to Mark-H/revolution that referenced this pull request Nov 28, 2022
opengeek pushed a commit that referenced this pull request Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core bug The issue in the code or project, which should be addressed. cla-signed CLA confirmed for contributors to this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants