Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not write error to log file #41

Open
petrabarus opened this issue Mar 15, 2018 · 0 comments · May be fixed by #71
Open

Could not write error to log file #41

petrabarus opened this issue Mar 15, 2018 · 0 comments · May be fixed by #71

Comments

@petrabarus
Copy link

petrabarus commented Mar 15, 2018

While debugging for this issue Codeception/Codeception#4871, I keep getting message Could not write error to log file.
When I traced the cause, it's from here.

c3/c3.php

Lines 36 to 43 in c7348bb

$errorLogFile = defined('C3_CODECOVERAGE_ERROR_LOG_FILE') ?
C3_CODECOVERAGE_ERROR_LOG_FILE :
C3_CODECOVERAGE_MEDIATE_STORAGE . DIRECTORY_SEPARATOR . 'error.txt';
if (is_writable($errorLogFile)) {
file_put_contents($errorLogFile, $message);
} else {
$message = "Could not write error to log file ($errorLogFile), original message: $message";
}

Apparently the c3tmp directory is always emptied by __c3_clear() when the test is executed.

c3/c3.php

Lines 288 to 291 in c7348bb

if ($route === 'clear') {
__c3_clear();
return __c3_exit();
}

This cause problem because is_writable returns true if the file exists and is writable.

http://php.net/manual/en/function.is-writable.php

@marcovtwout marcovtwout linked a pull request May 19, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant