Skip to content

Commit 7f3cf65

Browse files
committed
Handle the case where an ID field is set in the request but the value is null. This is a valid Request object in JSONRPC 2.0
1 parent 81fcf4e commit 7f3cf65

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/React/Decoder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ public function handleData($input)
112112
}
113113

114114
if (isset($data['method'])) {
115-
if (isset($data['id'])) {
115+
// If the ID field is contained in the request even if NULL then we consider it to be Request
116+
if (isset($data['id']) || array_key_exists('id', $data)) {
116117
$jsonrpc = new Request($data['method'], $data['params'] ?? [], $data['id']);
117118
} else {
118119
$jsonrpc = new Notification($data['method'], $data['params']);

0 commit comments

Comments
 (0)