Skip to content

Commit 8ce0ee2

Browse files
committed
Merge branch '6.4' into 7.2
* 6.4: fix rendering notifier message options Enable `JSON_PRESERVE_ZERO_FRACTION` in `jsonRequest` method [TwigBridge] Fix compatibility with Twig 3.21
2 parents 14cb0cb + ce95f3e commit 8ce0ee2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

AbstractBrowser.php

+1-1
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');

Tests/AbstractBrowserTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ public function testXmlHttpRequest()
6868
public function testJsonRequest()
6969
{
7070
$client = $this->getBrowser();
71-
$client->jsonRequest('GET', 'http://example.com/', ['param' => 1], [], true);
71+
$client->jsonRequest('GET', 'http://example.com/', ['param' => 1, 'float' => 10.0], [], true);
7272
$this->assertSame('application/json', $client->getRequest()->getServer()['CONTENT_TYPE']);
7373
$this->assertSame('application/json', $client->getRequest()->getServer()['HTTP_ACCEPT']);
7474
$this->assertFalse($client->getServerParameter('CONTENT_TYPE', false));
7575
$this->assertFalse($client->getServerParameter('HTTP_ACCEPT', false));
76-
$this->assertSame('{"param":1}', $client->getRequest()->getContent());
76+
$this->assertSame('{"param":1,"float":10.0}', $client->getRequest()->getContent());
7777
}
7878

7979
public function testGetRequestWithIpAsHttpHost()

0 commit comments

Comments
 (0)