Skip to content

Commit 205a522

Browse files
committed
require php8
1 parent 88863a4 commit 205a522

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"phpbench/phpbench": "1.0.1"
2020
},
2121
"require": {
22-
"php": ">=7.3"
22+
"php": ">=8.0"
2323
},
2424
"autoload": {
2525
"psr-4": {

src/Servers/Server.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ private function getQuery(): ?string
152152
{
153153
// check if query is sent as raw http body in request as "application/json" or via post fields as "multipart/form-data"
154154
$headers = apache_request_headers();
155-
if (array_key_exists("Content-Type", $headers)
156-
and in_array($headers["Content-Type"], ["application/json", "application/json;charset=utf-8"])) {
155+
if (array_key_exists("Content-Type", $headers) and str_contains($headers["Content-Type"], "application/json")) {
157156
// raw json string in http body
158157
$phpInput = json_decode(file_get_contents("php://input"), true);
159158
return $phpInput["query"] ?? null;
@@ -172,7 +171,7 @@ private function getOperationName(): ?string
172171
{
173172
// check if query is sent as raw http body in request as "application/json" or via post fields as "multipart/form-data"
174173
$headers = function_exists("getallheaders") ? getallheaders() : [];
175-
if (array_key_exists("Content-Type", $headers) and $headers["Content-Type"] === "application/json") {
174+
if (array_key_exists("Content-Type", $headers) and str_contains($headers["Content-Type"], "application/json")) {
176175
// raw json string in http body
177176
$phpInput = json_decode(file_get_contents("php://input"), true);
178177
return $phpInput["operationName"] ?? null;
@@ -191,7 +190,7 @@ private function getVariables(): array
191190
{
192191
// check if variables is sent as raw http body in request as "application/json" or via post fields as "multipart/form-data"
193192
$headers = function_exists("getallheaders") ? getallheaders() : [];
194-
if (array_key_exists("Content-Type", $headers) and $headers["Content-Type"] === "application/json") {
193+
if (array_key_exists("Content-Type", $headers) and str_contains($headers["Content-Type"], "application/json")) {
195194
// raw json string in http body
196195
$phpInput = json_decode(file_get_contents("php://input"), true);
197196
return $phpInput["variables"] ?? [];

0 commit comments

Comments
 (0)