Skip to content

Commit

Permalink
Check if debug function is_callable before execution.
Browse files Browse the repository at this point in the history
Cases where configuration variables do not evaulate to true/false result in errors when Swift
attempts to call that value as a function.
  • Loading branch information
Jason Moore committed Oct 18, 2013
1 parent ecdf9ec commit 0190b0c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions classes/Swift/AWSTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ public function getResponse() {
}

protected function _debug ( $message ) {
if( false === $this->debug ) { return; }
if( true === $this->debug ) { error_log( $message ); }
else { call_user_func( $this->debug, $message ); }
if ( true === $this->debug ) {
error_log( $message );
} elseif ( is_callable($this->debug) ) {
call_user_func( $this->debug, $message );
}
}

/**
Expand Down

0 comments on commit 0190b0c

Please sign in to comment.