Skip to content

Commit 961c9ae

Browse files
Enable JSON_PRESERVE_ZERO_FRACTION in jsonRequest method
Updated the jsonRequest method to use JSON_PRESERVE_ZERO_FRACTION when encoding parameters. This ensures that floating-point values retain their precision, avoiding unintended rounding of numbers like 0.0.
1 parent 983e8fa commit 961c9ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/BrowserKit/AbstractBrowser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function xmlHttpRequest(string $method, string $uri, array $parameters =
163163
*/
164164
public function jsonRequest(string $method, string $uri, array $parameters = [], array $server = [], bool $changeHistory = true): Crawler
165165
{
166-
$content = json_encode($parameters);
166+
$content = json_encode($parameters, JSON_PRESERVE_ZERO_FRACTION);
167167

168168
$this->setServerParameter('CONTENT_TYPE', 'application/json');
169169
$this->setServerParameter('HTTP_ACCEPT', 'application/json');

0 commit comments

Comments
 (0)