PHP 4.0 Bug #5446: split() is returning garbage characters
| From: | rasmus@php.net | Date: | Fri, 07 Jul 2000 21:14:58 +0000 |
| Subject: | PHP 4.0 Bug #5446: split() is returning garbage characters | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-23749@lists.php.net to get a copy of this message | ||
From: rasmus@php.net
Operating system: Linux 2.4
PHP version: 4.0 Latest CVS (07/07/2000)
PHP Bug Type: Misbehaving function
Bug description: split() is returning garbage characters
$fp = fopen('slideshow.txt','r');
while(true) {
$line = fgets($fp,256);
if(!feof($fp)) {
list($file,$text) = split('[[:space:]]+',$line,2);
echo $text."<br>\n";
} else break;
}
and slideshow.txt contains:
title.php Scripting the Web
agenda.php Agenda
intro.php Introduction
history.php History
numbers.php Usage Numbers
Output:
Scripting the Web
Agenda
Introduction
History a
Usage Numbers
Note the extra 'a' on the History line. This character changes on every reload. Smells
like an off-by-one somewhere.