# [PATCH] Bug #42866 str_split() returns extra char when given string size is not multiple of length

- Thread: https://externals.io/message/33220
- Original archive: https://news-web.php.net/php.internals/33220
- Started by Claudio Cherubino on 2007-11-17T13:45:00+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #33220 — Claudio Cherubino — 2007-11-17T13:45:00+00:00

URL: https://externals.io/message/33220#33220

Bug Description:
-----------------
 `str_split()` returns extra characters when given string is not multiple 
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.
The bug only occurs on PHP6 with UNICODE ON.

It can be fixed by changing only a single line of the code.
Please give a look at the attached patch, I don't have CVS access to 
commit it.
Thanks

Claudio Cherubino
