Copy and modify mb_str_pad from str_pad#2750
Conversation
ndossche
left a comment
There was a problem hiding this comment.
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.
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.
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)
| <term><parameter>length</parameter></term> | ||
| <listitem> | ||
| <para> | ||
| If the value of <parameter>length</parameter> is negative, |
There was a problem hiding this comment.
Is no ValueError emitted for negative lengths?
There was a problem hiding this comment.
Yes, no ValueError throws.
$ sapi/cli/php -r 'var_dump(mb_str_pad("あいうえお", -333, "🎉", STR_PAD_BOTH));'
string(15) "あいうえお"
|
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