From 042b1e50461a3edd11da98e104362936f3effea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Tue, 19 May 2026 10:41:46 +0400 Subject: [PATCH] =?UTF-8?q?fix:=20PHP=20env=20PSR-7=20format=20=E2=80=94?= =?UTF-8?q?=20getBody()->write()=20instead=20of=20return=20array?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/test_heavy.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/test_heavy.sh b/scripts/test_heavy.sh index 0b29dbb..72003ac 100755 --- a/scripts/test_heavy.sh +++ b/scripts/test_heavy.sh @@ -450,7 +450,7 @@ function isPrime($n) { return true; } -function handler(array $ctx): array { +function handler($ctx) { global $CONSTS; $mat = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]; $data = range(1, 50); @@ -474,7 +474,7 @@ function handler(array $ctx): array { 'is_prime_97'=> isPrime(97), 'groups_3' => groupByMod(array_slice($data, 0, 30), 3), ]; - return ['statusCode' => 200, 'body' => json_encode($result)]; + $ctx["response"]->getBody()->write(json_encode($result)); } PHPEOF create_json "php" "$FN_BIG_PHP" "${TMP}/big_php.php" @@ -564,8 +564,8 @@ function fib($n) { if ($n < 2) return $n; return fib($n-1) + fib($n-2); } -function handler(array $ctx): array { - return ['statusCode' => 200, 'body' => 'cpu-burn-php:' . fib(28)]; +function handler($ctx) { + $ctx["response"]->getBody()->write('cpu-burn-php:' . fib(28)); } PHPEOF create_json "php" "$FN_CPU_PHP" "${TMP}/cpu_php.php" @@ -711,8 +711,8 @@ python3 - > "${TMP}/arc-php.zip" << 'EOF' import zipfile, io, sys buf = io.BytesIO() code = """ 200, 'body' => json_encode(['tag' => 'archive-php-ok', 'fib25' => 75025])]; +function handler($ctx) { + $ctx[\"response\"]->getBody()->write(json_encode(['tag' => 'archive-php-ok', 'fib25' => 75025])); } """ with zipfile.ZipFile(buf, 'w', zipfile.ZIP_DEFLATED) as zf: