From: [EMAIL PROTECTED]
Operating system: Windows XP Pro
PHP version: 4.2.0
PHP Bug Type: Scripting Engine problem
Bug description: explode()-function is not working correctly with Carriage Returns
Hello,
I just installed PHP4.2.0 RC4 on my System using IIS 5.1 with all patches.
I installed PHP as ISAPI module, I ran before PHP 4.1.2 as CGI where the
following worked correctly:
A propgram running in background saves every 10 secons the actual traffic
into a file "jetzt.log", each line is separeted with a carraige return and
a line feed "\r\n" - like any other textfile under windows.
For example it looks as the following:
34.865
9.763
0 Tage 1 Stunden 9 Minuten 41 Sekunden
16
And here is my script:
<?
$fp = fopen("jetzt.log","r");
$file = fread($fp, filesize ("jetzt.log"));
fclose($fp);
$haufen = explode("\r\n", $file)
echo "Downstream: ".$haufen[0]."<br />\r\n";
echo "Upstream: ".$haufen[1]."<br />\r\n";
echo "Uptime: ".$haufen[2]."<br />\r\n";
echo "CPU Usage: ".$haufen[3]."%";
?>
In PHP 4.1.2 the content of jetzt.log was seperated into the array $haufen
and the script printed it fine out. Since PHP 4.2.0 all content of
jetzt.log is written into $haufen[0], including carriage returns and line
feeds. It is the same when I only use "\r" as seperator; when I use "\n",
the content is correctly seperated but at the end of each line there is
stil a carriage return.
I found a comparable problem at http://bugs.php.net/bug.php?id=3428
Best regards
Mark Aslan Kuschel
--
Edit bug report at http://bugs.php.net/?id=16714&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=16714&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=16714&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=16714&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=16714&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16714&r=support
Expected behavior: http://bugs.php.net/fix.php?id=16714&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=16714&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=16714&r=submittedtwice