@@ -1498,6 +1498,11 @@ public function createRequest(string $method, $uri): RequestInterface
1498
1498
1499
1499
public function createResponse (int $ code = 200 , string $ reasonPhrase = '' ): ResponseInterface
1500
1500
{
1501
+ if (2 > \func_num_args ()) {
1502
+ // This will make the Response class to use a custom reasonPhrase
1503
+ $ reasonPhrase = null ;
1504
+ }
1505
+
1501
1506
return new Response ($ code , [], null , '1.1 ' , $ reasonPhrase );
1502
1507
}
1503
1508
@@ -1951,7 +1956,7 @@ public function __construct(int $status = 200, array $headers = [], $body = null
1951
1956
if (null === $ reason && isset (self ::PHRASES [$ this ->statusCode ])) {
1952
1957
$ this ->reasonPhrase = self ::PHRASES [$ status ];
1953
1958
} else {
1954
- $ this ->reasonPhrase = $ reason ;
1959
+ $ this ->reasonPhrase = $ reason ?? '' ;
1955
1960
}
1956
1961
1957
1962
$ this ->protocol = $ version ;
@@ -2226,7 +2231,7 @@ public static function create($body = ''): StreamInterface
2226
2231
$ new = new self ();
2227
2232
$ new ->stream = $ body ;
2228
2233
$ meta = \stream_get_meta_data ($ new ->stream );
2229
- $ new ->seekable = $ meta ['seekable ' ];
2234
+ $ new ->seekable = $ meta ['seekable ' ] && 0 === \fseek ( $ new -> stream , 0 , \ SEEK_CUR ) ;
2230
2235
$ new ->readable = isset (self ::READ_WRITE_HASH ['read ' ][$ meta ['mode ' ]]);
2231
2236
$ new ->writable = isset (self ::READ_WRITE_HASH ['write ' ][$ meta ['mode ' ]]);
2232
2237
$ new ->uri = $ new ->getMetadata ('uri ' );
@@ -2854,8 +2859,8 @@ private function filterPort($port) /*:?int*/
2854
2859
}
2855
2860
2856
2861
$ port = (int ) $ port ;
2857
- if (1 > $ port || 0xffff < $ port ) {
2858
- throw new \InvalidArgumentException (\sprintf ('Invalid port: %d. Must be between 1 and 65535 ' , $ port ));
2862
+ if (0 > $ port || 0xffff < $ port ) {
2863
+ throw new \InvalidArgumentException (\sprintf ('Invalid port: %d. Must be between 0 and 65535 ' , $ port ));
2859
2864
}
2860
2865
2861
2866
return self ::isNonStandardPort ($ this ->scheme , $ port ) ? $ port : null ;
@@ -10618,6 +10623,7 @@ public static function toString(ResponseInterface $response): string
10618
10623
'username ' => 'php-crud-api ' ,
10619
10624
'password ' => 'php-crud-api ' ,
10620
10625
'database ' => 'php-crud-api ' ,
10626
+ 'controllers ' => 'records,columns '
10621
10627
]);
10622
10628
$ request = RequestFactory::fromGlobals ();
10623
10629
$ api = new Api ($ config );
0 commit comments