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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun May 11 11:01:28 2025 UTC