-
Notifications
You must be signed in to change notification settings - Fork 711
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
Fixed replace modifier by converting encoding if needed #590
Conversation
Now, this should be more robust. Turned out, not every UNICODE encoding supported by mbstring regex is equally supported by I've considered using |
|
||
/** @var array Source data for tests, hexed to protect from accidental reencoding */ | ||
private $data = array( | ||
"subject" => '4772c3bc6e6577616c64', // "Grünewald" |
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.
Please add "regex sensitive" characters to the test strings just to prove that your regex quoting and splitting works.
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.
You mean, characters like {}
?
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.
These should be added to parent tests, I presume. Since this is regression only test.
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.
Yes characters like that and: . + * \ / ? ( ) [ ]
Thanks.
Bump. This fixes |
`mb_split` will fail if `$pattern` or `$string` contains byte sequences not valid for `mb_regex_encoding()`. Convert both strings and set regex encoding before calling `mb_split()` if needed. Fixes smarty-php#549
Opened a related PR #740 against 3.1 maintenance branch. |
Related patch #740 into 3.1 branch has been committed recently. Please review this one too. |
@wisskid did you backport these changes manually? If so, feel free to close this PR. |
@AnrDaemon yes, I did. 20a8026 |
mb_split
will fail if$pattern
or$string
contains byte sequences not valid formb_regex_encoding()
.Convert both strings and set regex encoding before calling
mb_split()
if needed.Fixes #549