PHP 4.0 Bug #6504 Updated: Explode and split misbehave if multiple separators without values
| From: | Bug Database | Date: | Tue, 03 Oct 2000 03:16:08 +0000 |
| Subject: | PHP 4.0 Bug #6504 Updated: Explode and split misbehave if multiple separators without values | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-34031@lists.php.net to get a copy of this message | ||
ID: 6504
Updated by: sniper
Reported By: sami@iqs.fi
Status: Closed
Bug Type: *General Issues
Assigned To:
Comments:
No feedback. Can not reproduce.
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2000-09-02 22:52:13] sniper@php.net
I can not reproduce this using php4.0.3-dev (latest CVS) in RH6.2 and compiled
as CGI.
--Jani
---------------------------------------------------------------------------
[2000-09-02 14:33:19] sami@iqs.fi
I have a script that reads tab separated values from a file. It seems that if the file contains
multiple tabs without data in between, explode and split return the second tab as the first
character of the next string.
E.g:
$str = "texttsome moretteven more";
$vals = explode("t", $str);
and you get
$vals = array("text", "some more", "teven more");
I would, of course, expect to get
$vals = array("text", "some more", "", "even more");
This is very annoying, I need to first replace every "tt" with something like "t
t" and then check if some of the values is " " and convert it into "".
The same behaviour is found in split().
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=6504