check is_resource Closes #2201.
This commit is contained in:
parent
7f1369e01a
commit
07a126de3e
|
@ -67,7 +67,7 @@ class WC_Logger {
|
|||
* @return void
|
||||
*/
|
||||
public function add( $handle, $message ) {
|
||||
if ( $this->open( $handle ) ) {
|
||||
if ( $this->open( $handle ) && is_resource( $this->_handles[ $handle ] ) ) {
|
||||
$time = date_i18n( 'm-d-Y @ H:i:s -' ); //Grab Time
|
||||
fwrite( $this->_handles[ $handle ], $time . " " . $message . "\n" );
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class WC_Logger {
|
|||
*/
|
||||
public function clear( $handle ) {
|
||||
|
||||
if ( $this->open( $handle ) )
|
||||
if ( $this->open( $handle ) && is_resource( $this->_handles[ $handle ] ) )
|
||||
ftruncate( $this->_handles[ $handle ], 0 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue