ID:               16714
 Comment by:       Slava at Philips dot com
 Reported By:      webmaster at irgendware dot com
 Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: Windows XP Pro
 PHP Version:      4.2.0
 New Comment:

Related report #16714:

Problem is not 'Bogus', it's Real.
Different behavior in Linux and Windows with same set of tools.

Problem confirmed with Win (tested with IIS  XP Pro and 2K Server) and
PHP 4.3.1: When string has 'return' in it, will not be exploded with
'return', however 'space' will explode where 'return' symbol is.

Same script working fine for PHP 4.2 & Linux, however for Windows in
'Explode' function all 'returns' must be replaced with 'space' for
script to work.

I�m editing script in 'Notepad' and
'return' above mean "
", not "\r".

Reagrds

Slava


Previous Comments:
------------------------------------------------------------------------

[2002-04-21 13:04:53] [EMAIL PROTECTED]

You can just use \n for that. Or open the script as binary. (PHP
translates \r\n on Windows to \n, unless you've opened the file as
binary)

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

[2002-04-20 14:34:48] webmaster at irgendware dot com

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 this bug report at http://bugs.php.net/?id=16714&edit=1

Reply via email to