Bug #14658 Updated: The strtok() changes destroyed 4 years old applications!
| From: | derick@php.net | Date: | Sat, 22 Dec 2001 11:55:45 +0000 |
| Subject: | Bug #14658 Updated: The strtok() changes destroyed 4 years old applications! | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-74782@lists.php.net to get a copy of this message | ||
ID: 14658
Updated by: derick
Reported By: hofmann@hofmann-int.de
Old Status: Open
Status: Bogus
Bug Type: Feature/Change Request
Operating System: Linux, Solaris, Windows
PHP Version: 4.1.0
New Comment:
We are aware of this situation, and after some discussion on the mailinglist, we will not change it
back.
However, to read CSV files, there is function fgetcvs
(http://www.php.net/manual/en/function.fgetcsv.php) which should do exactly what you want.
Derick
Previous Comments:
------------------------------------------------------------------------
[2001-12-22 05:46:46] hofmann@hofmann-int.de
The change made in 4.1.0 to strtok() destroyed my applications from the past 4 years!
Thats because I used strtok() to read data from CSV (comma separated values) files - for which it
works perfektly!
For CSV (not only separated with commans - also with | and other symbols) it is required that EMPTY
fields will be reported as empty field!!! So the change you made brokes my existing applications.
For parsing tokens as explained I understand the change - because there you wont need empty tokens!
But for real parsing strtok is useless(!) because you always have more than one separator - for
human language parsing you need space, return/line feed, full stop as well as comma, questionmark
etc. as separators! strtok() fails here as it seems to me!!!
So my suggestion ist - to restore the old behaviour for CSV parsing and adding a new command like
strparse() that will work with a list of separators!!!
Greetings
Dipl.-Inform. Kai Hofmann
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14658&edit=1