Bug #66760 [NEW]: error_log returns true when it fails when log file is read only

From: Date: Mon, 24 Feb 2014 04:17:09 +0000
Subject: Bug #66760 [NEW]: error_log returns true when it fails when log file is read only
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184389@lists.php.net to get a copy of this message
From: hj at BridgeportContractor dot com Operating system: windows 7, x64 & Linux PHP version: 5.4.25 Package: Unknown/Other Function Bug Type: Bug Bug description:error_log returns true when it fails when log file is read only 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 -- Edit bug report at https://bugs.php.net/bug.php?id=66760&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66760&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66760&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66760&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=66760&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=66760&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=66760&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=66760&r=needscript Try newer version: https://bugs.php.net/fix.php?id=66760&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=66760&r=support Expected behavior: https://bugs.php.net/fix.php?id=66760&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=66760&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=66760&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=66760&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66760&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=66760&r=dst IIS Stability: https://bugs.php.net/fix.php?id=66760&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=66760&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=66760&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=66760&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=66760&r=mysqlcfg

« previous php.bugs (#184389) next »