Bug #75897 [Opn]: error_log() results in inappropriate/inconsistent Apache severity
| From: | requinix@php.net | Date: | Wed, 31 Jan 2018 22:33:52 +0000 |
| Subject: | Bug #75897 [Opn]: error_log() results in inappropriate/inconsistent Apache severity | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213771@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75897&edit=1
ID: 75897
Updated by: requinix@php.net
Reported by: bjohnson at paylease dot com
Summary: error_log() results in inappropriate/inconsistent
Apache severity
Status: Open
Type: Bug
Package: Apache2 related
Operating System: any
PHP Version: 7.1.13
Block user comment: N
Private report: N
New Comment:
The first point is a documented change:
http://php.net/migration71.incompatible#migration71.incompatible.error_log-syslog
> If the error_log ini setting is set to syslog [0], the PHP error levels are mapped to the
> syslog error levels.
The second point ("Was this difference in behavior between message type 0 and 4
intended?") is still questionable.
Previous Comments:
------------------------------------------------------------------------
[2018-01-31 22:22:39] bjohnson at paylease dot com
Description:
------------
PHP 7.1 changed the behavior of PHP messages delivered to Apache2: specifically now PHP messages
will have an Apache severity corresponding to the PHP severity. Previous to 7.1 the Apache severity
was always 'warn'.
This change brought with it two undesired side effects for calls to the built-in error_log()
function when the error_log INI directive is un-set.
1. A simple call of error_log('some message') will have an Apache severity of
'notice', which may be lower than a user's Apache error LogLevel is set
2. When the error_log INI directive is unset, and using the Apache2 SAPI, the following three calls
should be equivalent:
error_log('message');
error_log('message', 0);
error_log('message', 4);
However the first two will result is a 'notice' level message, while the third will result
in an 'error' level message.
More discussion regarding the how/why of this behavior can be found in this pull request: https://github.com/php/php-src/pull/1981
Test script:
---------------
<?php
error_log('message');
error_log('message', 0);
error_log('message', 4);
Expected result:
----------------
The following three commands should have consistent behavior when the error_log INI directive is
unset. If using the Apache2 SAPI, the message severity should be 'error'
error_log('message');
error_log('message', 0);
error_log('message', 4);
Actual result:
--------------
The first two commands will have a 'notice' severity. The third will have
'error'.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75897&edit=1