check is_resource Closes #2201.

This commit is contained in:
Mike Jolley 2013-01-10 14:56:07 +00:00
parent 7f1369e01a
commit 07a126de3e
1 changed files with 2 additions and 2 deletions

View File

@ -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 );
}