Check if is a resource before try set log rotate

Fixes #14544
This commit is contained in:
Claudio Sanches 2017-04-20 00:54:31 -03:00
parent bd92f99359
commit aa21db2e64
1 changed files with 1 additions and 1 deletions

View File

@ -266,7 +266,7 @@ class WC_Log_Handler_File extends WC_Log_Handler {
protected function should_rotate( $handle ) {
$file = self::get_log_file_path( $handle );
if ( $file ) {
if ( $this->is_open( $handle ) ) {
if ( $this->is_open( $handle ) && is_resource( $this->handles[ $handle ] ) ) {
$file_stat = fstat( $this->handles[ $handle ] );
return $file_stat['size'] > $this->log_size_limit;
} elseif ( file_exists( $file ) ) {