From:             [EMAIL PROTECTED]
Operating system: Red Hat Linux 7.2
PHP version:      4.3.0
PHP Bug Type:     Documentation problem
Bug description:  str_pad will pad even if input_len + pad_str_len > pad_length

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 bug report at http://bugs.php.net/?id=21318&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21318&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21318&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21318&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21318&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21318&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21318&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21318&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21318&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21318&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21318&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21318&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21318&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21318&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21318&r=gnused


-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to