|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13419 strtok doesn't properly work with "#" as a token
Submitted: 2001-09-24 15:29 UTC Modified: 2001-09-24 19:04 UTC
From: ckoontz at yahoo dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: OS: linux 2.4.9 (debian unstable)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ckoontz at yahoo dot com
New email:
PHP Version: OS:


 [2001-09-24 15:29 UTC] ckoontz at yahoo dot com
in the following code:
$string = "#This is an example string";
$tok1 = strtok($string,"#");

$tok1 should equal nothing.. however it equals $string

This bug breaks ACID:

people on IRC have verified that this bug is also in CVS as of this report


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-09-24 16:17 UTC]
This is not a bug. This is the way strtok() works. Although PHP uses its own implementation, strtok() under C works the same and PHP mimics the C version (anything else would render this function useless).

No bug, bogusifying.

If you need similar functionality take a look at explode()/split()

- Markus
 [2001-09-24 19:04 UTC] ckoontz at yahoo dot com
If this is bogus.. make sure you document the change...
doing strtok($moo,"#") worked fine in earler releases...
I'm fairly certian it worked in 4.0.6

 [2002-09-19 04:07 UTC] luca-80 at libero dot it
I have found a way to run this correct:

In acid_common.php
replace the script in /* ... */
with my one, that's work

  $seq = strtok("-");     
  $sid = strtok("-");
  $cid = strtok(")");


  $boo = ereg_replace ("\#", " ", $submit);  
  $boo = ereg_replace ("\(", " ", $boo);    
  $boo = ereg_replace ("\)", " ", $boo);    
  $boo = trim($boo);    
  $pieces = explode("-", $boo);  
  $seq = $pieces[0];
  $sid = $pieces[1];
  $cid = $pieces[2];
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 10:01:28 2024 UTC