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: