#21318 [Opn->Csd]: str_pad will pad even if input_len + pad_str_len > pad_length
| From: | hholzgra@php.net | Date: | Fri, 04 Jul 2003 22:08:16 +0000 |
| Subject: | #21318 [Opn->Csd]: str_pad will pad even if input_len + pad_str_len > pad_length | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969355043@lists.php.net to get a copy of this message | ||
ID: 21318
Updated by: hholzgra@php.net
Reported By: jc at mega-bucks dot co dot jp
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Red Hat Linux 7.2
PHP Version: 4.3.0
Assigned To: hholzgra
New Comment:
This bug has been fixed in CVS.
In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2003-01-01 05:35:33] jc at mega-bucks dot co dot jp
str_pad pad the input string even when the length of the pad string
cannot be evenly dived into the length of the input stirng +
pad_length.
This is not necessarily a bug but the behaviour should be documented.
I.e. in some cases the user might want the string be padded only with
*full-length* pad strings, and not truncated pad strings.
The following code illustrates:
echo str_pad("1", 2, "AB");
OUPUT:
1A
The output could be viewed as "incorrect" since pad_str was aksed to
pad with "AB", not to pad with "A".
Thanks!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21318&edit=1