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

[8.x] Fix Str::headline/Str::studly with unicode and add Str::ucsplit method #40499

Merged
merged 3 commits into from
Jan 20, 2022
Merged

[8.x] Fix Str::headline/Str::studly with unicode and add Str::ucsplit method #40499

merged 3 commits into from
Jan 20, 2022

Conversation

stevebauman
Copy link
Contributor

@stevebauman stevebauman commented Jan 19, 2022

Description

This PR resolves issues with unicode characters mentioned in issue #40468, fixing Str::headline() and Str::studly().

I've also added another Str helper function ucsplit() to split a string based on casing, which is compatible with english and unicode characters. This new function is used by Str::headline(), to help with parsing strings that do not contain spaces.

All previous tests pass and there are no BC breaks 🎉

Let me know if you have any concerns/questions, thanks for your time! ❤️

@nunomaduro
Copy link
Member

@taylorotwell I feel that this should target 9.x.

@foremtehan
Copy link
Contributor

foremtehan commented Jan 20, 2022

@stevebauman i found a issue with headline method:

Str::headline('Year 2022')

the result is Year2022, Is this ok ?

@stevebauman
Copy link
Contributor Author

stevebauman commented Jan 20, 2022

@foremtehan I'm not able to reproduce this with this new patch:

// Displays: "Year 2022"
echo Str::headline('Year 2022');

@foremtehan
Copy link
Contributor

Look like it will be fix via this PR, I'm on v8.77.1 and this method has that issue.

@stevebauman
Copy link
Contributor Author

You're right I'm able to reproduce that as well on v8.x. I've just added some extra assertions so we can ensure this bug is resolved 👍

@taylorotwell taylorotwell merged commit 3d50d37 into laravel:8.x Jan 20, 2022
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.

4 participants