-
-
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
Bugfix: mbstring polyfills must not raise value errors in PHP 7 #501
base: 1.x
Are you sure you want to change the base?
Conversation
9eb2c0b
to
847748a
Compare
847748a
to
b2da01d
Compare
@@ -133,27 +133,27 @@ function mb_str_split($string, $length = 1, $encoding = null) { return p\Mbstrin | |||
} | |||
|
|||
if (!function_exists('mb_str_pad')) { | |||
function mb_str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = STR_PAD_RIGHT, ?string $encoding = null): string { return p\Mbstring::mb_str_pad($string, $length, $pad_string, $pad_type, $encoding); } |
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.
what about a bootstrap80.php file to add the return types when running on PHP8+?
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.
That file already exists. ✌🏻
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.
ah indeed :)
there are some failures to fix ;)
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.
Can you help we with those? Apparently, the test listener is skipping tests at a strange point in time which conflicts with the expectWarning()
feature of PHPUnit. How do we solve that usually?
b2da01d
to
94414f3
Compare
94414f3
to
fca78f8
Compare
Let's also address #506 here? |
Fixes #499.
This PR changes all new mbstring polyfills on PHP 7 so that they trigger an oldschool PHP warning instead of raising a
ValueError
. The reason for that is that theValueError
class might not be available on PHP 7 and the behavior is more consitent with the other polyfills of the mbstring extension.The somewhat weird side-effect is that we now polyfill a behavior that was never implemented in PHP.