We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
$data
1 parent 57f5ee3 commit cf3ca86Copy full SHA for cf3ca86
examples/01-blog/graphql.php
@@ -36,9 +36,18 @@
36
if (isset($_SERVER['CONTENT_TYPE']) && strpos($_SERVER['CONTENT_TYPE'], 'application/json') !== false) {
37
$raw = file_get_contents('php://input') ?: '';
38
$data = json_decode($raw, true);
39
+ // $data += will cause 'Unsupported operand types' Fatal error on `null`
40
+ // check if decoded data is an array (or stdobject) - not null
41
+ // if any kind of data is present we don't want to lose it
42
+ if ($data === null) {
43
+ $data = [];
44
+ }
45
} else {
46
$data = $_REQUEST;
47
}
48
+
49
50
51
$data += ['query' => null, 'variables' => null];
52
53
if (null === $data['query']) {
0 commit comments