Bug #75897 [Com]: error_log() results in inappropriate/inconsistent Apache severity
Edit report at https://bugs.php.net/bug.php?id=75897&edit=1
ID: 75897
Comment by: bjohnson at paylease dot com
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:
Thank you for your response, requinx. However, I do not believe your link/quote addresses the first
issue I've raised. I'm specifically discussing the scenario when the error_log INI
directive is unset, not when it is set to syslog. Further, my complaint is not that PHP error levels
are mapped to Apache error levels. I acknowledged that as a documented, desired change in the
opening of my bug description. My complaint is that when error_log INI is unset, and using the
Apache SAPI, simple calls to the error_log() function such as error_log('message') are now
Apache 'notice' level. Previous to 7.1 they were 'warn' level. In the linked PR
it was suggested they should be 'error' level: https://github.com/php/php-src/pull/1981#issuecomment-361684885
Regarding the inconsistency in severity when explicitly sending the message to SAPI logger as
opposed to letting it fall there by default because error_log INI directive is unset, that
inconsistency would be... odd, if intended. But, if that were the case it should at least be
documented. The author of the PR seems to suggest it was unintended: https://github.com/php/php-src/pull/1981#issuecomment-360932281
Previous Comments:
------------------------------------------------------------------------
[2018-01-31 22:33:50] requinix@php.net
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.
------------------------------------------------------------------------
[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
Thread (6 messages)