Commit 9d9499ad authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Robert Lyon

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

behatnotneeded
Change-Id: Ic6f9e5df4ee083b972ed32aad2ae2cf240040f24
parent f7eeee18
......@@ -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