|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27921 strtok seems to return only the first chunk
Submitted: 2004-04-08 10:06 UTC Modified: 2004-04-08 11:03 UTC
From: scratch65536 at att dot net Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.4 OS: W2K
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
31 - 4 = ?
Subscribe to this entry?

 [2004-04-08 10:06 UTC] scratch65536 at att dot net
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:
$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=


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-08 11:03 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Pass the break again, not the string.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 22 00:01:29 2024 UTC