Skip to content

Commit

Permalink
Fix notice when handling c3 error before C3_CODECOVERAGE_MEDIATE_STOR…
Browse files Browse the repository at this point in the history
…AGE is defined
  • Loading branch information
marcovtwout committed May 19, 2021
1 parent 6253181 commit f7811b9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions c3.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@
if (!function_exists('__c3_error')) {
function __c3_error($message)
{
$errorLogFile = defined('C3_CODECOVERAGE_ERROR_LOG_FILE') ?
C3_CODECOVERAGE_ERROR_LOG_FILE :
C3_CODECOVERAGE_MEDIATE_STORAGE . DIRECTORY_SEPARATOR . 'error.txt';
if (defined('C3_CODECOVERAGE_ERROR_LOG_FILE')) {
$errorLogFile = C3_CODECOVERAGE_ERROR_LOG_FILE;
} elseif (defined('C3_CODECOVERAGE_MEDIATE_STORAGE')) {
$errorLogFile = C3_CODECOVERAGE_MEDIATE_STORAGE . DIRECTORY_SEPARATOR . 'error.txt';
} else {
$errorLogFile = null;
}
if (is_writable($errorLogFile)) {
file_put_contents($errorLogFile, $message);
} else {
Expand Down

0 comments on commit f7811b9

Please sign in to comment.