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

Fix substr on unicode string #409

Open
wants to merge 1 commit into
base: 1.9/develop
Choose a base branch
from

Conversation

Seb-C
Copy link

@Seb-C Seb-C commented Jun 21, 2017

This replaces substr by mb_substr.

My specific case happened with a varchar(250) field, and a string that was longer. The 250th and 251th bytes of the string were an UTF-8 non-breakable space (0xC2A0).

Since C2 is a control character that can't exist alone, this made everything using this string crash thereafter (including debugging tools).

@WanWizard
Copy link
Member

That code will fail if mbstring isn't loaded. Ideally, this should use \Str::truncate(), which is multibyte aware.

I think this needs to be looked at in more broader terms, quite a bit of the Fuel was written when overloading string functions was the norm, which isn't the case anymore, and is even deprecated as of PHP 7.2.

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.

None yet

2 participants