ID: 13866
Updated by: jmoore
Reported By: [EMAIL PROTECTED]
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] [EMAIL PROTECTED]

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
[EMAIL PROTECTED]

------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=13866&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to