Skip to content

Commit

Permalink
Supress potential E_NOTICES about integer overflows due to unusually …
Browse files Browse the repository at this point in the history
…high/low scores.
  • Loading branch information
bezhermoso authored and polyfractal committed Nov 6, 2014
1 parent 693ceec commit 9b22a3c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Elasticsearch/Serializers/SmartSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ public function deserialize($data, $headers)
{
if (isset($headers['content_type']) === true) {
if (strpos($headers['content_type'], 'json') !== false) {
return json_decode($data, true);

// Unusually high/low scores may cause integer overflows. Supress E_NOTICEs momentarily.
$e = error_reporting();
error_reporting($e ^ E_NOTICE);
$decoded = json_decode($data, true);
error_reporting($e);

return $decoded;
} else {
//Not json, return as string
return $data;
Expand Down

0 comments on commit 9b22a3c

Please sign in to comment.