Skip to content

Commit

Permalink
Merge pull request #89 from simaranjit/JsonFailureLog
Browse files Browse the repository at this point in the history
json_encode might fail and that should be logged
  • Loading branch information
zimbatm committed Feb 5, 2016
2 parents 5beda03 + 91f3653 commit b7f39ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/Pusher.php 100644 → 100755
Expand Up @@ -18,6 +18,7 @@
+ Zack Kitzmiller (delicious@zackisamazing.com)
+ Andrew Bender (igothelp@gmail.com)
+ Phil Leggetter (phil@leggetter.co.uk)
+ Simaranjit Singh (simaranjit.singh@virdi.me)
*/

class PusherException extends Exception
Expand Down Expand Up @@ -363,6 +364,11 @@ public function trigger( $channels, $event, $data, $socket_id = null, $debug = f

$data_encoded = $already_encoded ? $data : json_encode( $data );

// json_encode might return false on failure
if (!$data_encoded) {
$this->Log('Failed to perform json_encode on the the provided data: ' . print_r( $data, true ));
}

$post_params = array();
$post_params[ 'name' ] = $event;
$post_params[ 'data' ] = $data_encoded;
Expand Down

0 comments on commit b7f39ff

Please sign in to comment.