-
Notifications
You must be signed in to change notification settings - Fork 59
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 split filter for php >=8.0 in case of empty separator #213
Fix split filter for php >=8.0 in case of empty separator #213
Conversation
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.
There's a failing test. Please fix and request re-review.
src/Liquid/StandardFilters.php
Outdated
return mb_str_split($input); | ||
} | ||
|
||
if (empty($pattern)) { |
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.
There's a problem in this condition. Can you see it?
@@ -621,6 +621,10 @@ public static function split($input, $pattern) | |||
return []; | |||
} | |||
|
|||
if ($pattern === '') { | |||
return mb_str_split($input); |
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.
Matches the behavior of the upstream project 👍
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.
Thanks!
For php >8.0 split filter throws ValueError when separator parameter is an empty string.
vendor/bin/phpunit
(php 8.2)build/coverage/index.html
vendor/bin/php-cs-fixer fix