Commit 19a68352 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug 1750477:Fix for JSON_PRESERVE_ZERO_FRACTION not defined in php version <5.6.6"

parents a0e5430d 9d9499ad
......@@ -1167,7 +1167,14 @@ class PluginSearchElasticsearch extends PluginSearch {
$clientopts = self::get_client_config($type);
$clientBuilder = ClientBuilder::create();
$clientBuilder->setHosts($clientopts['hosts'])->setConnectionParams(['client' => ['curl' => $clientopts['curlopts']]]);
// php versions < 5.6.6 dont have JSON_PRESERVE_ZERO_FRACTION defined
if (version_compare(phpversion(), '5.6.6', '<') || !defined('JSON_PRESERVE_ZERO_FRACTION')) {
$clientBuilder->setHosts($clientopts['hosts'])->setConnectionParams(['client' => ['curl' => $clientopts['curlopts']]])->allowBadJSONSerialization();
}
else {
$clientBuilder->setHosts($clientopts['hosts'])->setConnectionParams(['client' => ['curl' => $clientopts['curlopts']]]);
}
$client = $clientBuilder->build();
return $client;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment