Bug #13866 Updated: strtok() parses erroneously empty substrings - PHP 4.0.7RC2
| From: | jmoore@php.net | Date: | Fri, 02 Nov 2001 19:21:18 +0000 |
| Subject: | Bug #13866 Updated: strtok() parses erroneously empty substrings - PHP 4.0.7RC2 | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-69543@lists.php.net to get a copy of this message | ||
ID: 13866
Updated by: jmoore
Reported By: rcpj@panix.com
Old Status: Open
Status: Closed
Bug Type: Strings related
Operating System: Linux
PHP Version: 4.0.6
New Comment:
fixed in CVS
Previous Comments:
------------------------------------------------------------------------
[2001-10-29 17:32:55] rcpj@panix.com
NOTE, the PHP version is reported as 4.0.7RC2 but that's not in the predefined list on the
form.
------
The function strtok() misparses strings where some fields are empty, such as #1 and #4 in the list
below,
1|carrot||(no adjective)
2|pepper|red|(adjective)
3|pepper|green|(adjective)
4|tomato||(no adjective)
5|apricot|dried|(adjective)
Compare the output of the test program (the code is listed below) running (under PHP 4.0.7RC2) at:
http://www.web-ho.com/PHP/test-module.php
versus the same program (under PHP 4.0.3pl1) at:
http://www.pierrejelenc.com/PHP/test-module.php
Both the Apache module and the CGI version in /usr/local/bin/php are affected.
============== test-module.php =============
<?php
$Item=file("test-data");
for ($i=0; $i<count($Item);$i++)
{
$Number=strtok(chop($Item[$i]),"|");
$Name=strtok("|");
$Type=strtok("|");
$Comment=strtok("|");
print("$Type $Name: line #$Number $Comment<br>\n");
}
?>
</body></html>
===========================================
I am not in charge of program maintenance on either system, but I am the webmaster for several sites
there. I was encouraged by the administrator of the machine on which web-ho.com is located to report
this myself.
Cheers,
Pierre Jelenc
rcpj@panix.com
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=13866&edit=1