#31544 [NEW]: chunk_split() unexpected result
From: warcraft2002 at libero dot it
Operating system: Linux
PHP version: Irrelevant
PHP Bug Type: Strings related
Bug description: chunk_split() unexpected result
Description:
------------
string chunk_split ( string body [, int chunklen [, string end]])
chunk_split() inserts end to the end of the string too, if the last chunk
is long exactly as chunklen.
Following the definition, this is expected:
(quoted from the function page):
"It inserts end (defaults to "\r\n") every chunklen characters"
BUT, this can be unuseful for some procedures. I'm not sure if this
behavior was expected by you or if is a bug/mistake.
Reproduce code:
---------------
$string="00001111";
$splitted=chunk_split($string,4," ");
echo $splitted;
Expected result:
----------------
echo $splitted returns "0000 1111 " (without the " and WITH the ending
space. I expected "0000 1111" (without the ending space and without the "
)
Actual result:
--------------
Actually I reach my expected result adding:
$splitted=rtrim($splitted);
before echoing...
--
Edit bug report at http://bugs.php.net/?id=31544&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31544&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=31544&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=31544&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31544&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31544&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31544&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31544&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31544&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31544&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31544&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=31544&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=31544&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31544&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31544&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31544&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31544&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31544&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31544&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31544&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31544&r=mysqlcfg
Thread (2 messages)
- warcraft2002 at libero dot it