php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46916 Logging Messages Terminated With \r\r\n
Submitted: 2008-12-21 02:24 UTC Modified: 2008-12-23 18:23 UTC
From: Brian dot White at foxfire74 dot com Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 5.2.8 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Brian dot White at foxfire74 dot com
New email:
PHP Version: OS:

 

 [2008-12-21 02:24 UTC] Brian dot White at foxfire74 dot com
Description:
------------
Since the upgrade to 5.2.7/5.2.8 lines in the log file are terminated with "\r\r\n" rather than "\r\n".

I am logging to a separate log file, not to the Apache error log; however the error seems not to occur when logging from the CLI, only from the SAPI module.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-21 12:59 UTC] jani@php.net
Please show the code you use to log.
 [2008-12-22 00:17 UTC] Brian dot White at foxfire74 dot com
Running as an Apache 2.2.11 module.  (Windows XP SP3)

Error handling and logging section from php.ini
===============================================
error_reporting  =  E_ALL
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
error_log = "/path-to-logs/php/error.log"


Simple web page that blows up
=============================
<?php 
	ini_set('max_execution_time', 1);

	$i = 0;
	do {
		echo "$i\n";
		sleep(1);
	} while ($i++ < 10);
?>


Log file after accessing the above page twice
=============================================


[21-Dec-2008 19:02:07] PHP Fatal error:  Maximum execution time of 1 second exceeded in \path-to-test-page\46916.php on line 10

[21-Dec-2008 19:03:11] PHP Fatal error:  Maximum execution time of 1 second exceeded in \path-to-test-page\46916.php on line 10


Note the extra <CR>s.
 [2008-12-23 17:03 UTC] jani@php.net
PHP only adds PHP_EOL (in your case \r\n) to the log messages so that extra \r comes somewhere else.
 [2008-12-23 18:23 UTC] Brian dot White at foxfire74 dot com
This was actually an escaping problem by caused by using the same log for both 5.2.7 and 5.2.8.  Checking previous error logs, I notices at ALL lines are terminated with \r\r\n.  Do to some unusual escape sequences in the file the log file view I was using became confused about the termination character.  Starting a fresh log file rectified the problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 19:01:30 2024 UTC