php.net |  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: -
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
Description:
------------
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 :-)


Thanks.




Test script:
---------------
<?php 
// 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:

error_reporting(E_ALL);

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:
----------------
false

Actual result:
--------------
true

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 11:01:24 2019 UTC