ID:               30393
 Updated by:       [EMAIL PROTECTED]
 Reported By:      richard dot quadling at bandvulc dot co dot uk
-Status:           Open
+Status:           Feedback
-Bug Type:         Scripting Engine problem
+Bug Type:         *Web Server problem
 Operating System: Windows XP SP2
 PHP Version:      5.0.2
 New Comment:

Reopen when you try 5.1 for real.


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

[2005-11-25 13:24:35] richard dot quadling at bandvulc dot co dot uk

The main.c line I'm interested in was changed 3 months ago ...

http://cvs.php.net/co.php/php-src/main/main.c?r=1.645

 Revision 1.645, Wed Aug 17 03:52:17 2005 (3 months, 1 week ago) by
sniper
Changed since 1.644: +2 -2
Log:
Fix EOLs under winblows

 log_file = VCWD_FOPEN(PG(error_log), "ab");

Prior to this it was just "a"

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

[2005-11-25 13:22:13] richard dot quadling at bandvulc dot co dot uk

NOT IIS!!!!!!

I'm using Sambar Server with ISAPI and CLI.

If the error log file is now being opened in binary mode, then the line
endings are wrong somehow.

<?php $a = 1 / 0; ?>

generates different line endings when run via a browser and when run
via the CLI.

[25-Nov-2005 12:03:57] PHP Warning:  Division by zero in Unknown on
line 0
[25-Nov-2005 12:03:58] PHP Warning:  Division by zero in Unknown on
line 0
[25-Nov-2005 12:03:59] PHP Warning:  Division by zero in Unknown on
line 0
[25-Nov-2005 12:03:59] PHP Warning:  Division by zero in Unknown on
line 0
[25-Nov-2005 12:03:59] PHP Warning:  Division by zero in Unknown on
line 0
[25-Nov-2005 12:03:59] PHP Warning:  Division by zero in Unknown on
line 0
[25-Nov-2005 12:03:59] PHP Warning:  Division by zero in Unknown on
line 0
[25-Nov-2005 12:04:00] PHP Warning:  Division by zero in Unknown on
line 0
[25-Nov-2005 12:04:00] PHP Warning:  Division by zero in Unknown on
line 0
[25-Nov-2005 12:04:00] PHP Warning:  Division by zero in Unknown on
line 0
[25-Nov-2005 12:05:13] PHP Warning:  Division by zero in Unknown on
line 0

[25-Nov-2005 12:05:14] PHP Warning:  Division by zero in Unknown on
line 0

[25-Nov-2005 12:05:15] PHP Warning:  Division by zero in Unknown on
line 0

[25-Nov-2005 12:05:15] PHP Warning:  Division by zero in Unknown on
line 0

[25-Nov-2005 12:05:15] PHP Warning:  Division by zero in Unknown on
line 0

[25-Nov-2005 12:05:15] PHP Warning:  Division by zero in Unknown on
line 0

[25-Nov-2005 12:05:15] PHP Warning:  Division by zero in Unknown on
line 0

[25-Nov-2005 12:05:15] PHP Warning:  Division by zero in Unknown on
line 0


Additional \r when ran from ISAPI.


Here is the thing.

In windows, fopen("file","a") will open a file in TEXT mode.

This means ANY \n will become \r\n when the file is written. This is
the nature of the C library. All known and correct.

So, if the line ending as defined in main\php.h says that lines endings
are \r\n AND the file is opened in text mode (which it was), then \r\n
will become \r\r\n which is does.

BUT only for the ISAPI version.

Now.

I've amended the script to show DIRECTORY_SEPARATOR and PHP_EOL ...

<?php
var_dump(DIRECTORY_SEPARATOR);
var_dump(PHP_EOL);
$a = 1 / 0;
?>

On both ISAPI and CLI, the output on screen is the same. The PHP_EOL is
2 bytes in size. This is correct.

But when that gets to the error log file, it is wrong. An extra \r has
crept in somewhere.

This is on PHP 5.0.5.

I'm just about to try out 5.1.0

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

[2005-11-25 13:03:51] [EMAIL PROTECTED]

>The function php_log_err (main\main.c line 344) only uses
> append mode - "a" - to open the file.
No, it doesn't:
log_file = VCWD_FOPEN(PG(error_log), "ab");

>Which will be in text mode and "\r\n" will
>become "\r\r\n", as "\n" => "\r\n" in a text file.
Could you plz explain this?
Why "\n" will suddenly become "\r\n" ?

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

[2005-11-25 12:49:02] richard dot quadling at bandvulc dot co dot uk

Still not working.

Errors logged from CLI and ISAPI have different line endings on
Windows.

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

[2005-03-15 01:00:18] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/30393

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

Reply via email to