-
-
Notifications
You must be signed in to change notification settings - Fork 134
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 tests for php 5.5.35/5.6.21/7.0.6 #62
Conversation
See also https://3v4l.org/Svk6W |
We should keep a test covering negative indexes, to ensure they produce the same behavior than PHP for each version (being accepted silently as 0, being rejected, or being taken from the end in PHP 7.1) |
@stof fixed |
@@ -177,7 +177,11 @@ private static function grapheme_position($s, $needle, $offset, $mode) | |||
if ($offset > 0) { | |||
$s = self::grapheme_substr($s, $offset); | |||
} elseif ($offset < 0) { | |||
$offset = 0; | |||
if (PHP_VERSION_ID < 50535 || PHP_VERSION_ID < 50621 || PHP_VERSION_ID < 70006) { |
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.
this is wrong, as it will also match PHP 5.6.22 (as 50622 is smaller than 70006). It should be this:
if (PHP_VERSION_ID < 50535 || (PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50621) || (PHP_VERSION_ID >= 70000 && PHP_VERSION_ID < 70006)) {
$offset = 0;
} else {
return false;
}
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.
Pff indeed, fixed
👍 |
Thank you @nicolas-grekas. |
This PR was merged into the 1.1-dev branch. Discussion ---------- Fix tests for php 5.5.35/5.6.21/7.0.6 See tchwork/utf8#59 Commits ------- 99a2aeb Fix tests for php 5.5.35/5.6.21/7.0.6
See tchwork/utf8#59