|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66760 error_log returns true when it fails when log file is read only
Submitted: 2014-02-24 04:17 UTC Modified: 2021-02-17 11:53 UTC
From: hj at BridgeportContractor dot com Assigned:
Status: Open Package: Unknown/Other Function
PHP Version: 5.4.25 OS: windows 7, x64 & Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-02-24 04:17 UTC] hj at BridgeportContractor dot com
If the log file is read only on either Win or Linux error_log() still returns true as a success flag, even thought the log message was never written.  It should return false I think if the log is not written.  

?? Is this a cgi thing?  Don't think so, because my win-7 php is Apache mod-php, and the linux-php is fastcgi.

...A meta bug: an error, in the error_log :-)


Test script:
// I'm not sure you need all this to demonstrate the problem, but this is what // I have set that might possibly relate to this issue:


ini_set('display_errors'		,'On');
ini_set('log_errors'			,'On');
ini_set('error_log'			,'/php_errors.log');
ini_set('display_startup_errors'	,'On');
ini_set('ignore_repeated_errors'	,'Off');
ini_set('ignore_repeated_source'	,'off');

ini_set('log_errors_max_len'		,1024);

var_dump(error_log('test'));   // When php_errors.log is read only in windows,
                               // or 444 in Linux this returns true but 
                               // should return false.  What I want is if the
                               // log fails that I can report it elsewhere.

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-17 11:50 UTC]
Oh, indeed, that happens whenever $message_type===0.  The basic
problem is that php_log_err_with_severity() is a void function,
and as such cannot report success/failure.  Changing this would
constitute an ABI break, and as such cannot be done for any stable
PHP version.

Anyhow, this should be documented.
 [2021-02-17 11:53 UTC]
> Anyhow, this should be documented.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Dec 09 23:01:27 2023 UTC