diff --git a/src/Elasticsearch/Serializers/SmartSerializer.php b/src/Elasticsearch/Serializers/SmartSerializer.php index 6fa200f39..8317a1743 100644 --- a/src/Elasticsearch/Serializers/SmartSerializer.php +++ b/src/Elasticsearch/Serializers/SmartSerializer.php @@ -33,7 +33,7 @@ public function serialize($data): string } else { $data = json_encode($data, JSON_PRESERVE_ZERO_FRACTION + JSON_INVALID_UTF8_SUBSTITUTE); if ($data === false) { - throw new Exceptions\RuntimeException("Failed to JSON encode: ".json_last_error()); + throw new Exceptions\RuntimeException("Failed to JSON encode: ".json_last_error_msg()); } if ($data === '[]') { return '{}';