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>
|
/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 |
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.