Skip to content

Commit

Permalink
Issue #185: Float encoding problem (#186)
Browse files Browse the repository at this point in the history
* Issue #185: Float encoding problem

* Fixed codestyle in Http.php

* Fixed codestyle in PhpHttp.php

---------

Co-authored-by: Sergey Nikolaev <[email protected]>
  • Loading branch information
tinigin and sanikolaev authored Jan 12, 2024
1 parent 8a8838a commit da726dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/Manticoresearch/Transport/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ public function execute(Request $request, $params = [])
$headers[] = sprintf('Content-Type: %s', $request->getContentType());
if (!empty($data)) {
if (is_array($data)) {
$content = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$content = json_encode(
$data,
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRESERVE_ZERO_FRACTION
);
} else {
$content = $data;
}
Expand Down
5 changes: 4 additions & 1 deletion src/Manticoresearch/Transport/PhpHttp.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ public function execute(Request $request, $params = [])
$data = $request->getBody();
if (!empty($data)) {
if (is_array($data)) {
$content = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$content = json_encode(
$data,
JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRESERVE_ZERO_FRACTION
);
} else {
$content = $data;
}
Expand Down

0 comments on commit da726dc

Please sign in to comment.