check return type on log file fopen

This commit is contained in:
Ewout Fernhout 2021-03-16 12:05:06 +01:00
parent d7eb6d0b9e
commit c51f748855
1 changed files with 6 additions and 4 deletions

View File

@ -146,10 +146,12 @@ class WC_Log_Handler_File extends WC_Log_Handler {
if ( $file ) {
if ( ! file_exists( $file ) ) {
$temphandle = @fopen( $file, 'w+' ); // @codingStandardsIgnoreLine.
@fclose( $temphandle ); // @codingStandardsIgnoreLine.
if ( Constants::is_defined( 'FS_CHMOD_FILE' ) ) {
@chmod( $file, FS_CHMOD_FILE ); // @codingStandardsIgnoreLine.
if ( is_resource( $temphandle ) ) {
@fclose( $temphandle ); // @codingStandardsIgnoreLine.
if ( Constants::is_defined( 'FS_CHMOD_FILE' ) ) {
@chmod( $file, FS_CHMOD_FILE ); // @codingStandardsIgnoreLine.
}
}
}