Skip to content

Commit 28003b0

Browse files
authored
Enforce JSON validity (#996)
1 parent 0db2111 commit 28003b0

15 files changed

+18
-14
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## NOT RELEASED
44

5+
### Fixed
6+
7+
- Assert the provided Input can be json-encoded.
8+
59
## 1.1.0
610

711
### Added

src/Input/BatchGetItemInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function request(): Request
8888

8989
// Prepare Body
9090
$bodyPayload = $this->requestBody();
91-
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload);
91+
$body = empty($bodyPayload) ? '{}' : \json_encode($bodyPayload, 4194304);
9292

9393
// Return the Request
9494
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));

src/Input/BatchWriteItemInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function request(): Request
108108

109109
// Prepare Body
110110
$bodyPayload = $this->requestBody();
111-
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload);
111+
$body = empty($bodyPayload) ? '{}' : \json_encode($bodyPayload, 4194304);
112112

113113
// Return the Request
114114
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));

src/Input/CreateTableInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ public function request(): Request
229229

230230
// Prepare Body
231231
$bodyPayload = $this->requestBody();
232-
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload);
232+
$body = empty($bodyPayload) ? '{}' : \json_encode($bodyPayload, 4194304);
233233

234234
// Return the Request
235235
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));

src/Input/DeleteItemInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function request(): Request
246246

247247
// Prepare Body
248248
$bodyPayload = $this->requestBody();
249-
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload);
249+
$body = empty($bodyPayload) ? '{}' : \json_encode($bodyPayload, 4194304);
250250

251251
// Return the Request
252252
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));

src/Input/DeleteTableInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function request(): Request
6262

6363
// Prepare Body
6464
$bodyPayload = $this->requestBody();
65-
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload);
65+
$body = empty($bodyPayload) ? '{}' : \json_encode($bodyPayload, 4194304);
6666

6767
// Return the Request
6868
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));

src/Input/DescribeTableInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function request(): Request
6262

6363
// Prepare Body
6464
$bodyPayload = $this->requestBody();
65-
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload);
65+
$body = empty($bodyPayload) ? '{}' : \json_encode($bodyPayload, 4194304);
6666

6767
// Return the Request
6868
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));

src/Input/GetItemInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public function request(): Request
172172

173173
// Prepare Body
174174
$bodyPayload = $this->requestBody();
175-
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload);
175+
$body = empty($bodyPayload) ? '{}' : \json_encode($bodyPayload, 4194304);
176176

177177
// Return the Request
178178
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));

src/Input/ListTablesInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function request(): Request
7474

7575
// Prepare Body
7676
$bodyPayload = $this->requestBody();
77-
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload);
77+
$body = empty($bodyPayload) ? '{}' : \json_encode($bodyPayload, 4194304);
7878

7979
// Return the Request
8080
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));

src/Input/PutItemInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public function request(): Request
247247

248248
// Prepare Body
249249
$bodyPayload = $this->requestBody();
250-
$body = empty($bodyPayload) ? '{}' : json_encode($bodyPayload);
250+
$body = empty($bodyPayload) ? '{}' : \json_encode($bodyPayload, 4194304);
251251

252252
// Return the Request
253253
return new Request('POST', $uriString, $query, $headers, StreamFactory::create($body));

0 commit comments

Comments
 (0)