From d857a92d2a5eb5202662c67b129a26ee5377b757 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Tue, 27 Aug 2024 15:09:56 +0200 Subject: [PATCH] fix tests for PHP-master --- tests/client002.phpt | 2 +- tests/client028.phpt | 42 +++++++++++++++++++++--------------------- tests/info002.phpt | 12 ++++++------ 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/client002.phpt b/tests/client002.phpt index d020f16..8849ae9 100644 --- a/tests/client002.phpt +++ b/tests/client002.phpt @@ -15,7 +15,7 @@ echo "Test\n"; class Observer implements SplObserver { #[ReturnTypeWillChange] - function update(SplSubject $client, http\Client\Request $request = null, StdClass $progress = null) { + function update(SplSubject $client, ?http\Client\Request $request = null, ?StdClass $progress = null) { echo "P"; /* fence against buggy infof() calls in some curl versions */ $compare = $client->getProgressInfo($request); diff --git a/tests/client028.phpt b/tests/client028.phpt index f14fb8e..482fc6c 100644 --- a/tests/client028.phpt +++ b/tests/client028.phpt @@ -1,12 +1,12 @@ --TEST-- client curl user handler --SKIPIF-- - +?> --FILE-- -client = $client; } - + function init($run) { $this->run = $run; } - + function timer(int $timeout_ms) { echo "T"; $this->timeout = $timeout_ms; } - + function socket($socket, int $action) { echo "S"; - + switch ($action) { case self::POLL_NONE: break; @@ -45,14 +45,14 @@ class UserHandler implements http\Client\Curl\User echo "U"; unset($this->fds["R"][$r]); } - + if (false !== ($w = array_search($socket, $this->fds["W"], true))) { echo "U"; unset($this->fds["W"][$w]); } - + break; - + default: if ($action & self::POLL_IN) { if (!in_array($socket, $this->fds["R"], true)) { @@ -67,10 +67,10 @@ class UserHandler implements http\Client\Curl\User break; } } - + function once() { echo "O"; - + foreach ($this->W as $w) { call_user_func($this->run, $this->client, $w, self::POLL_OUT); } @@ -79,18 +79,18 @@ class UserHandler implements http\Client\Curl\User } return count($this->client); } - - function wait(int $timeout_ms = null) { + + function wait(?int $timeout_ms = null) { echo "W"; - + if ($timeout_ms === null) { $timeout_ms = $this->timeout; } $ts = floor($timeout_ms / 1000); $tu = ($timeout_ms % 1000) * 1000; - + extract($this->fds); - + if (($wfds = count($R) + count($W))) { $nfds = stream_select($R, $W, $E, $ts, $tu); } else { @@ -98,7 +98,7 @@ class UserHandler implements http\Client\Curl\User } $this->R = (array) $R; $this->W = (array) $W; - + if ($nfds === false) { return false; } @@ -109,10 +109,10 @@ class UserHandler implements http\Client\Curl\User } call_user_func($this->run, $this->client); } - + return true; } - + function send() { $this->wait(); $this->once(); diff --git a/tests/info002.phpt b/tests/info002.phpt index 4d03440..46bfcf5 100644 --- a/tests/info002.phpt +++ b/tests/info002.phpt @@ -1,21 +1,21 @@ --TEST-- invalid HTTP info --SKIPIF-- - --INI-- zend.exception_ignore_args=off --FILE-- -__construct('HTTP/1.1 99 App...') -#1 %sinfo002.php(%d): {closure}() +#1 %sinfo002.php(%d): {closure%s}() #2 %sinfo002.php(%d): trap(Object(Closure)) #3 {main} http\Exception\BadMessageException: http\Message::__construct(): Failed to parse headers: unexpected character '\040' at pos 7 of 'CONNECT HTTP/1.1' in %sinfo002.php:%d Stack trace: #0 %sinfo002.php(%d): http\Message->__construct('CONNECT HTTP/1....') -#1 %sinfo002.php(%d): {closure}() +#1 %sinfo002.php(%d): {closure%s}() #2 %sinfo002.php(%d): trap(Object(Closure)) #3 {main} HTTP/1.1 200 -- 2.30.2