|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2018-01-31 22:22 UTC] 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'.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
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