Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions system/Validation/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,10 @@ public function withRequest(RequestInterface $request): ValidationInterface
if (strpos($request->getHeaderLine('Content-Type'), 'application/json') !== false) {
$this->data = $request->getJSON(true);

if (! is_array($this->data)) {
$this->data = [];
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should we do when $this->data is not an array?
Is it okay just to throw the value away?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, if we have decided to use Validation, it must be in the key-value format. If it is a special format, Validation is not applicable. Validation doesn't need to be as comprehensive as JSON schema.


return $this;
}

Expand Down