PHP 8.0 - CFileLogRoute throws TypeError when file cannot be opened
marcovtwout opened this issue · 0 comments
marcovtwout commented
What steps will reproduce the problem?
- Configure a default CFileLogRoute
- Remove write rights from runtime/application.log for the PHP-process
- Call index.php
What is the expected result?
Application.log cannot be written, but error is caught silently as is common in the current implementation of CFileLogRoute on PHP <= 7.4.
What do you get instead?
On PHP 8.0 a fatal error is thrown:
TypeError: flock(): Argument #1 ($stream) must be of type resource, bool given
(..)/vendor/yiisoft/yii/framework/logging/CFileLogRoute.php(157)
Additional info
Source: https://github.com/yiisoft/yii/blob/master/framework/logging/CFileLogRoute.php#L157
I'll prepare a PR.
Q | A |
---|---|
Yii version | master |
PHP version | 8.0 |
Operating system | Unix |