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

Add option to set a locale #546

Merged
merged 1 commit into from
Jun 14, 2020
Merged

Add option to set a locale #546

merged 1 commit into from
Jun 14, 2020

Conversation

asdfuser
Copy link
Contributor

As mentioned in https://www.php.net/manual/en/function.basename.php both
basename() and dirname() are locale aware.
An incorrect locale can cause the page tree to behave in strange ways.

For example the structure

/über-uns
|-index.md
|-impressum.md

could lead to the page impressum not being a child of über-uns.

Copy link
Collaborator

@PhrozenByte PhrozenByte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes I really, really hate PHP... 😒

This is super confusing. At first I though this is about a rather typical non-multibyte-aware implementation, but this doesn't seem to be the case. The binary representation of the ASCII character / (the path separator) is hex 2f, so any multibyte character that has a binary representation starting with hex 2f should cause basename() to see a non-existing path separator - like , whose binary representation is hex 2f00. But this doesn't seem to be the case. basename() just truncates any multibyte character at the beginning when no multibyte-aware locale is used? And PHP developers really think this is no bug? WTF?

Thank you for your contribution! ❤️ Please address the suggested changes below and I'll merge this 👍

config/config.yml.template Outdated Show resolved Hide resolved
lib/Pico.php Outdated Show resolved Hide resolved
lib/Pico.php Show resolved Hide resolved
As mentioned in https://www.php.net/manual/en/function.basename.php both
basename() and dirname() are locale aware.
An incorrect locale can cause the page tree to behave in strange ways.

For example the structure

/über-uns
 |-index.md
 |-impressum.md

could lead to the page impressum not being a child of über-uns.
@asdfuser asdfuser requested a review from PhrozenByte June 14, 2020 16:15
Copy link
Collaborator

@PhrozenByte PhrozenByte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks ❤️

@PhrozenByte PhrozenByte merged commit 60f27df into picocms:master Jun 14, 2020
@asdfuser
Copy link
Contributor Author

Great, thanks for the fast reaction!

@PhrozenByte PhrozenByte mentioned this pull request Jul 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants