fix tests for PHP-master
authorMichael Wallner <mike@php.net>
Tue, 27 Aug 2024 13:09:56 +0000 (15:09 +0200)
committerMichael Wallner <mike@php.net>
Tue, 27 Aug 2024 13:09:56 +0000 (15:09 +0200)
tests/client002.phpt
tests/client028.phpt
tests/info002.phpt

index d020f16e22ff4d5916b2ba4830ae1083c48c321a..8849ae94101fe43931f2470dfbfab63dc4ebe574 100644 (file)
@@ -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);
index f14fb8e5f7d9aadf9ede5e772abf3c9028385f2d..482fc6c75344aba14add24ed2990d98cebc42c35 100644 (file)
@@ -1,12 +1,12 @@
 --TEST--
 client curl user handler
 --SKIPIF--
-<?php 
+<?php
 include "skipif.inc";
 skip_client_test();
-?> 
+?>
 --FILE--
-<?php 
+<?php
 echo "Test\n";
 
 class UserHandler implements http\Client\Curl\User
@@ -20,23 +20,23 @@ class UserHandler implements http\Client\Curl\User
        private $R = array();
        private $W = array();
        private $timeout = 1000;
-       
+
        function __construct(http\Client $client) {
                $this->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();
index 4d0344030115ba691bad92ea2e860f03aaac1185..46bfcf5fa706067844bbbaba1e537d408898e130 100644 (file)
@@ -1,21 +1,21 @@
 --TEST--
 invalid HTTP info
 --SKIPIF--
-<?php 
+<?php
 include "skipif.inc";
 ?>
 --INI--
 zend.exception_ignore_args=off
 --FILE--
-<?php 
+<?php
 
 echo "Test\n";
 
 function trap($cb) {
        try {
                $cb();
-       } catch (Exception $e) { 
-               echo $e,"\n"; 
+       } catch (Exception $e) {
+               echo $e,"\n";
        }
 }
 
@@ -37,13 +37,13 @@ Test
 http\Exception\BadMessageException: http\Message::__construct(): Failed to parse headers: unexpected character '\057' at pos 4 of 'HTTP/1.1 99 Apples in my Basket' in %sinfo002.php:%d
 Stack trace:
 #0 %sinfo002.php(%d): http\Message->__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