#27921 [Opn->Bgs]: strtok seems to return only the first chunk
| From: | derick@php.net | Date: | Thu, 08 Apr 2004 15:03:20 +0000 |
| Subject: | #27921 [Opn->Bgs]: strtok seems to return only the first chunk | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-57781@lists.php.net to get a copy of this message | ||
ID: 27921
Updated by: derick@php.net
Reported By: scratch65536 at att dot net
-Status: Open
+Status: Bogus
Bug Type: Strings related
Operating System: W2K
PHP Version: 4.3.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Pass the break again, not the string.
Previous Comments:
------------------------------------------------------------------------
[2004-04-08 10:06:52] scratch65536 at att dot net
Description:
------------
The strtok function seems to return a chunk only the first time it's
called [ strtok( string, delim) ] Subsequent calls [ strtok( string ) ]
appear to return nothing.
I grepped for strtok in the changelist for 4.3.5, but saw nothing so I
presume it's still a problem.
I tested this in 2 environments:
4.3.2 running as a module under Apache 1.3.27 under W2K
4.3.4 running as a module under Apache 2.0 under W2K
Reproduce code:
---------------
<?php
$s = '01:02:03' ;
$h = strtok( $s, ':' ) ;
$m = strtok( $s ) ;
$s = strtok( $s ) ;
echo "h=$h, m=$m, s=$s <br>" ;
?>
yields h=01, m=, s=
Expected result:
----------------
I expected to see h=01, m=02, s=03
Actual result:
--------------
h=01, m=, s=
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27921&edit=1