php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41035 "log_errors_max_len" has no effect for values over 1024 or 0
Submitted: 2007-04-10 05:11 UTC Modified: 2007-04-10 14:05 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: sv_forums at fmethod dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.1 OS: Windows XP
Private report: No CVE-ID: None
 [2007-04-10 05:11 UTC] sv_forums at fmethod dot com
Description:
------------
The "log_errors_max_len" config option should allow us to disable the cap limit if we set it to 0. This has no effect and the actual limit remains 1024. Same about entering values over 1024.

Reproduce code:
---------------
1. Use the following error reporting settings:

	error_reporting(E_ALL|E_STRICT);
	ini_set('display_errors',0);
	ini_set('log_errors',1);
	ini_set('log_errors_max_len','0'); // alternatively use values larger than 1024, they also don't work
	ini_set('html_errors',0);

2. Produce a code with enough nested calls so when you throw an exception, together with the full stack trace, it'll be over 1024 bytes

3. Throw exception inside the chain.

4. Check the log.

Expected result:
----------------
Since in the example above I've set log_errors_max_len to 0, the log stack traces should not be clipped at the 1024 boundary, but it is.

Actual result:
--------------
The error report log gets clipped at 1024 bytes.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-10 07:55 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2007-04-10 13:17 UTC] webmaster at wiedmann-online dot de
'log_errors_max_len' is not the filesize of the logfile. It's the maximum lenght of an error message, printed in each log entry.

Reproduce code:
---------------
<?php
error_reporting(E_ALL);
header('Content-Type: text/plain');
if (file_exists('./phplog.log')) {
    unlink('./phplog.log');
}
touch('./phplog.log');
ini_set('display_errors', '0');
ini_set('log_errors', '1');
ini_set('error_log', realpath('./phplog.log'));
for ($i = 1; $i <=  5; $i++) {
    ini_set('log_errors_max_len', $i);
    trigger_error(str_repeat('-', 10), E_USER_WARNING);
}
readfile('./phplog.log');
?>

Actual result:
--------------
[10-Apr-2007 15:13:58] PHP Warning:  - in C:\php-5.2.1\testlog.php on line 13
[10-Apr-2007 15:13:58] PHP Warning:  -- in C:\php-5.2.1\testlog.php on line 13
[10-Apr-2007 15:13:58] PHP Warning:  --- in C:\php-5.2.1\testlog.php on line 13
[10-Apr-2007 15:13:58] PHP Warning:  ---- in C:\php-5.2.1\testlog.php on line 13
[10-Apr-2007 15:13:58] PHP Warning:  ----- in C:\php-5.2.1\testlog.php on line 13
 [2007-04-10 13:30 UTC] sv_forums at fmethod dot com
Description:
------------
The "log_errors_max_len" config option should allow us to disable the
cap limit if we set it to 0. This has no effect and the actual limit
remains 1024. Same about entering values over 1024.

Reproduce code:
---------------
1. Use the following sample code:

<?php
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors',0);
ini_set('log_errors',1);
ini_set('log_errors_max_len','0');
ini_set('html_errors',0);

function deepTrace($a, $b, $c) {
	if ($c < 50) {deepTrace($a, $b, $c+1);} else {throw new Exception('Example exception that together with the trace is over 1024 bytes.');}
}
deepTrace('example','function',0);
?>

2. Check the log.

Expected result:
----------------
Since in the example above I've set log_errors_max_len to 0, the log
stack traces should not be clipped at the 1024 boundary, but it is.

Actual result:
--------------
The error report log gets clipped at 1024 bytes.
 [2007-04-10 13:45 UTC] tony2001@php.net
0 is a special values which means "no limit".
Other values, including the ones greater than 1024 work perfectly fine.
 [2007-04-10 14:05 UTC] tony2001@php.net
Do not file bugs when you have Zend extensions (zend_extension=)
loaded. Examples are Zend Optimizer, Zend Debugger, Turck MM Cache,
APC, Xdebug and ionCube loader.  These extensions often modify engine
behavior which is not related to PHP itself.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 12:01:30 2024 UTC