note 89421 added to function.strtok
| From: | KrazyBox at osu1 dot php dot net | Date: | Sat, 07 Mar 2009 02:11:06 +0000 |
| Subject: | note 89421 added to function.strtok | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151578@lists.php.net to get a copy of this message | ||
As of the change in strtok()'s handling of empty strings, it is now useless for scripts that
rely on empty data to function.
Take for instance, a standard header. (with UNIX newlines)
http/1.0 200 OK\n
Content-Type: text/html\n
\n
--HTML BODY HERE---
When parsing this with strtok, one would wait until it found an empty string to signal the end of
the header. However, because strtok now skips empty segments, it is impossible to know when the
header has ended.
This should not be called `correct' behavior, it certainly is not. It has rendered strtok
incapable of (properly) processing a very simple standard.
This new functionality, however, does not affect Windows style headers. You would search for a line
that only contains "\r"
This, however, is not a justification for the change.
----
Server IP: 69.147.83.197
Probable Submitter: 24.102.58.146 (proxied: 127.0.0.1)
----
Manual Page -- http://www.php.net/manual/en/function.strtok.php
Edit -- https://master.php.net/note/edit/89421
Del: integrated -- https://master.php.net/note/delete/89421/integrated
Del: useless -- https://master.php.net/note/delete/89421/useless
Del: bad code -- https://master.php.net/note/delete/89421/bad+code
Del: spam -- https://master.php.net/note/delete/89421/spam
Del: non-english -- https://master.php.net/note/delete/89421/non-english
Del: in docs -- https://master.php.net/note/delete/89421/in+docs
Del: other reasons-- https://master.php.net/note/delete/89421
Reject -- https://master.php.net/note/reject/89421
Search -- https://master.php.net/manage/user-notes.php