php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #77667 Duplicate error log entries and date format not configurable
Submitted: 2019-02-25 20:17 UTC Modified: 2019-03-01 14:53 UTC
From: valentiny510 at gmail dot com Assigned:
Status: Open Package: *General Issues
PHP Version: 7.2.15 OS: Irrelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-02-25 20:17 UTC] valentiny510 at gmail dot com
Description:
------------
When you try to inlude a non existent file, in the log appear two similar entries.

[date] PHP Warning:  require(non_existent_file): failed to open stream: No such file or directory in .../index.php on line 5
[date] PHP Fatal error:  require(): Failed opening required 'non_existent_file' (include_path='...') in .../index.php on line 5

They are not exactly the same, so technically is a not a duplicate, but,
they point to the same error, is kinda redundant IMHO, and also a bit confusing
for the different error types, is just a Warning or Fatal error ?
Is clear that one error is because the 'stream' to be parsed is empty or non existent and the other is an error because of the language construct 'require'
does not have a valid file to include... Is not a bug, of course, that's why I am asking as a feature request to remove one of them, and let just one simpler entry, Ex: 'PHP Warning: file "xxx" not found, in file .../index.php, line 5'
Let only the Warning for instance since the included file may not be so important for the entire framework execution to be Fatal...

And if possible, PLEASE let us REMOVE THE TIMEZONE from the date of the logs...
preferably have a 'log_format = %H.%i.%s' in the php.ini settings
[..... Europe/IrrelevantCity]
(Of course I know that we can have a custom error log system implemented, but...)
Also would be nice (for security reasons) to have the option to NOT LOG the full paths, and log only the path/files.php relative to the root

 Thank you



Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-28 20:54 UTC] beberlei@php.net
These are not duplicate errors, but as you mentioned the warning leads to the follow up fatal error. The reason why it stops here is you are using require(), whose stated feature contrary to include() is exactly stopping the execution if the file cannot be loaded/executed. So everything here is working as expected. With include you get a second warning and execution continues.

Since include/require both allow stream wrappers, it is important to have both error messages, because the different systems need to be able to report the problems they have.
 [2019-02-28 21:15 UTC] beberlei@php.net
Pull Request for your date format feature request: https://github.com/php/php-src/pull/3899
 [2019-03-01 14:52 UTC] beberlei@php.net
The following pull request has been associated:

Patch Name: Add new core INI setting "error_date_format" to customize date format
On GitHub:  https://github.com/php/php-src/pull/3899
Patch:      https://github.com/php/php-src/pull/3899.patch
 [2019-03-01 14:53 UTC] beberlei@php.net
-Summary: Duplicate error log entries +Summary: Duplicate error log entries and date format not configurable
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Mar 21 01:01:30 2019 UTC