#13419 [Com]: strtok doesn't properly work with "#" as a token
| From: | luca-80 at libero dot it | Date: | Thu, 19 Sep 2002 09:07:03 +0000 |
| Subject: | #13419 [Com]: strtok doesn't properly work with "#" as a token | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-19716@lists.php.net to get a copy of this message | ||
ID: 13419
Comment by: luca-80@libero.it
Reported By: ckoontz@yahoo.com
Status: Bogus
Bug Type: Strings related
Operating System: linux 2.4.9 (debian unstable)
PHP Version: 4.0.6.7rc2
New Comment:
I have found a way to run this correct:
In acid_common.php
replace the script in /* ... */
with my one, that's work
/*
strtok($submit,"#");
$seq = strtok("-");
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];
Previous Comments:
------------------------------------------------------------------------
[2001-09-24 19:04:01] ckoontz@yahoo.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
------------------------------------------------------------------------
[2001-09-24 16:17:00] mfischer@php.net
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 15:29:53] ckoontz@yahoo.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:
http://www.cert.org/kb/acid/
people on IRC have verified that this bug is also in CVS as of this
report
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=13419&edit=1