For the record, this is probably the EXACT same problem that was dismissed
when I couldn't unserialize objects WRITTEN in CGI mode (non binary) with
both Apache Module and CGI version.

If I wrote the file with line breaks, with CGI -- the Apache module version
of PHP would die on the unserialize, but a CGI version unserialize worked
fine... I got told to always write in binary mode, and that the
inconsistency when reading was not important.

:(

Win32, btw

-Brian Tanner

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: July 8, 2001 3:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DEV] Bug #11961: \r\n or \n


From:             [EMAIL PROTECTED]
Operating system: Win98 SE
PHP version:      4.0.6
PHP Bug Type:     Unknown/Other Function
Bug description:  \r\n or \n

I've submitted this bug some days before but I didn't get very kind reply.
I decided to resubmit it.

test.php:
<?php
        $fp = fopen("test.txt", "r");
        $str = "";
        while (!feof($fp)) $str .= fgets($fp, 64);
        fclose($fp);
        echo count(split("\n", $str))."<br />".count(split("\r\n", $str));
?>

And I've put 3 random lines in test.txt
OK, my PHP is running as Apache module, so when I type
"localhost/test.php", I got the output "3<br />1".

Then, I run this script in CGI mode. This can be done simply by the command
"c:\php_path\php.exe test.php", and I will get the output "3<br />3".

OK, so PHP is not portable, even in the same platform but different PHP
running mode. CGI PHP and module PHP interpret "\r\n" differently.

--
Edit bug report at: http://bugs.php.net/?id=11961&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]


-- 
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