From:             kraghuba at in dot ibm dot com
Operating system: linux,win xp
PHP version:      6CVS-2007-10-05 (snap)
PHP Bug Type:     Strings related
Bug description:  str_split() returns extra char when given string size is not 
mulitple of lenth

Description:
------------
str_split() returns extra charecter when given string is not mulitple of
given length. for example if the given string size is 22 and split length
is 5, then the last element of the returned array contains 5 or more than 5
chars, which is wrong. The last element of the return array should only
contain 2 chars.

This behavior is only noticed on  PHP6 with UNICODE ON

Reproduce code:
---------------
<?php
$str = 'Testing str_split()';
$split_length = 5;

var_dump( str_split($str, $split_length) );

?>

Expected result:
----------------
array(4) {
  [0]=>
  unicode(5) "Testi"
  [1]=>
  unicode(5) "ng st"
  [2]=>
  unicode(5) "r_spl"
  [3]=>
  unicode(4) "it()"
}

Actual result:
--------------
array(4) {
  [0]=>
  unicode(5) "Testi"
  [1]=>
  unicode(5) "ng st"
  [2]=>
  unicode(5) "r_spl"
  [3]=>
  unicode(8) "it()[EMAIL PROTECTED]@1"
}

-- 
Edit bug report at http://bugs.php.net/?id=42866&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42866&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42866&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42866&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42866&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42866&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42866&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42866&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42866&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42866&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42866&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42866&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42866&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42866&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42866&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42866&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42866&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42866&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42866&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42866&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42866&r=mysqlcfg

Reply via email to