-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix missing setlocale with php 8 #29695
Conversation
When php version = 8, basename('§') does not bug even if LC_ALL is non-UTF-8 locale. This cause OC_Util::isSetLocaleWorking() to skip setlocale("C.UTF-8"). Fix it by using escapeshellcmd instead of basename. Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
73f133f
to
d2eb5aa
Compare
Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
/backport to stable23 |
What if |
not sure if it's as common as disabling the but you're right to be careful, is there a way to detect disabled functions ? |
@PVince81 https://www.php.net/manual/en/function.function-exists.php
|
Is |
Hard to say, but it is always a good practice check if the function exists before call it, and have a fallback 😉 |
Using escapeshellcmd to get current locale causes error if the function is disabled. Add fallbacks to prevent the error. Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
I think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine by me 👍
Signed-off-by: Naoto Kobayashi <naoto.kobayashi4c@gmail.com>
Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 |
seems the bot is lagging, no further backports yet? |
/backport to stable22 |
/backport to stable21 |
When php version = 8, basename('§') returns '§' even if LC_ALL is non-UTF-8 locale.
Since OC_Util::isSetLocaleWorking() assumes basename('§') returns empty string with non-UTF-8 locale,
the function with php 8 incorrectly skips setlocale("C.UTF-8").
Fix it by using escapeshellcmd instead of basename.
This issue found in #29296 and The PR may be able to resolve it.