-
Notifications
You must be signed in to change notification settings - Fork 735
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
Copy and modify mb_str_pad from str_pad #2750
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.
Looks mostly good, thanks for working on this.
Just some remarks.
<varlistentry> | ||
<term><parameter>encoding</parameter></term> | ||
<listitem> | ||
<para> |
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 whole paragraph may be replaced with the entity &mbstring.encoding.parameter;
(the para tags should be removed too, i.e.: <listitem>&mbstring.encoding.parameter;</listitem>
. (but I can't make a multi-line suggestion unfortunately)
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.
And I believe the note about the ValueError exception should be in a separate errors section.
https://www.php.net/manual/en/function.mb-strlen.php puts it in the error section, although it seems outdated because it claims a warning is raised instead of a ValueError... (https://3v4l.org/E9s0i)
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.
I filed an issue for the error conditions: #2751
<term><parameter>length</parameter></term> | ||
<listitem> | ||
<para> | ||
If the value of <parameter>length</parameter> is negative, |
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.
Is no ValueError emitted for negative lengths?
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, no ValueError throws.
$ sapi/cli/php -r 'var_dump(mb_str_pad("あいうえお", -333, "🎉", STR_PAD_BOTH));'
string(15) "あいうえお"
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.
sad :(
This also needs an entry in |
@Girgias Thank you very much. Add to reference/mbstring/versions.xml . |
I've mostly just copied from
str_pad
, so any pointers are welcome.closes: #2701