Commit e1b8b3ad authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Robert Lyon
Browse files

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

behatnotneeded
Change-Id: Ic6f9e5df4ee083b972ed32aad2ae2cf240040f24
(cherry picked from commit 9d9499ad)
parent 6fccd292
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1174,7 +1174,14 @@ class PluginSearchElasticsearch extends PluginSearch {
       $clientopts = self::get_client_config($type);

       $clientBuilder = ClientBuilder::create();

       // 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;