Index: vendor/laravel/framework/src/Illuminate/Support/Collection.php IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- vendor/laravel/framework/src/Illuminate/Support/Collection.php (revision ) +++ vendor/laravel/framework/src/Illuminate/Support/Collection.php (revision ) @@ -1736,7 +1736,15 @@ */ public function toJson($options = 0) { - return json_encode($this->jsonSerialize(), $options); + // Patch to convert INF or NAN to null. + $serialized = $this->jsonSerialize(); + $resp = json_encode($serialized, $options); + if (json_last_error() == JSON_ERROR_INF_OR_NAN) { + $resp = json_encode(unserialize( + str_replace(array('d:NAN;','d:INF;'), 'd:0;', serialize($serialized)) + ), $options); + } + return $resp; } /**