From 6bf61dfa6b585db01b607a79bd64ec9c583a9c10 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 14 Mar 2024 09:35:09 +0000 Subject: composer update and use the fixed streams php-jcs library until the floats issue will be fixed upstream. see here for reference https://codeberg.org/streams/streams/issues/151 --- vendor/sabre/http/CHANGELOG.md | 21 +++++++ vendor/sabre/http/lib/Client.php | 5 +- vendor/sabre/http/lib/Sapi.php | 6 ++ vendor/sabre/http/lib/Version.php | 2 +- vendor/sabre/uri/composer.json | 14 ++++- vendor/sabre/uri/lib/Version.php | 2 +- vendor/sabre/uri/lib/functions.php | 79 +++++++++++++++---------- vendor/sabre/xml/lib/Deserializer/functions.php | 2 +- vendor/sabre/xml/lib/Version.php | 2 +- 9 files changed, 94 insertions(+), 39 deletions(-) (limited to 'vendor/sabre') diff --git a/vendor/sabre/http/CHANGELOG.md b/vendor/sabre/http/CHANGELOG.md index 2dddce4fb..7c6f4b6ec 100644 --- a/vendor/sabre/http/CHANGELOG.md +++ b/vendor/sabre/http/CHANGELOG.md @@ -1,6 +1,27 @@ ChangeLog ========= +5.1.10 (2023-08-18) +------------------ + +* #225 Enhance tests/bootstrap.php to find autoloader in more environments (@phil-davis) + +5.1.9 (2023-08-17) +------------------ + +* #223 skip testParseMimeTypeOnInvalidMimeType (@phil-davis) + +5.1.8 (2023-08-17) +------------------ + +* #215 Improve CURLOPT_HTTPHEADER Setting Assignment (@amrita-shrestha) + +5.1.7 (2023-06-26) +------------------ + +* #98 and #176 Add more tests (@peter279k) +* #207 fix: handle client disconnect properly with ignore_user_abort true (@kesselb) + 5.1.6 (2022-07-15) ------------------ diff --git a/vendor/sabre/http/lib/Client.php b/vendor/sabre/http/lib/Client.php index 2bc7483a7..0837e8d2a 100644 --- a/vendor/sabre/http/lib/Client.php +++ b/vendor/sabre/http/lib/Client.php @@ -402,7 +402,10 @@ class Client extends EventEmitter $nHeaders[] = $key.': '.$value; } } - $settings[CURLOPT_HTTPHEADER] = $nHeaders; + + if ([] !== $nHeaders) { + $settings[CURLOPT_HTTPHEADER] = $nHeaders; + } $settings[CURLOPT_URL] = $request->getUrl(); // FIXME: CURLOPT_PROTOCOLS is currently unsupported by HHVM if (defined('CURLOPT_PROTOCOLS')) { diff --git a/vendor/sabre/http/lib/Sapi.php b/vendor/sabre/http/lib/Sapi.php index f8e8397fc..55a4c46e7 100644 --- a/vendor/sabre/http/lib/Sapi.php +++ b/vendor/sabre/http/lib/Sapi.php @@ -115,6 +115,12 @@ class Sapi if ($copied <= 0) { break; } + // Abort on client disconnect. + // With ignore_user_abort(true), the script is not aborted on client disconnect. + // To avoid reading the entire stream and dismissing the data afterward, check between the chunks if the client is still there. + if (1 === ignore_user_abort() && 1 === connection_aborted()) { + break; + } $left -= $copied; } } else { diff --git a/vendor/sabre/http/lib/Version.php b/vendor/sabre/http/lib/Version.php index 47582f22e..93c64797b 100644 --- a/vendor/sabre/http/lib/Version.php +++ b/vendor/sabre/http/lib/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - const VERSION = '5.1.6'; + const VERSION = '5.1.10'; } diff --git a/vendor/sabre/uri/composer.json b/vendor/sabre/uri/composer.json index 0e0cf2d36..03c33877c 100644 --- a/vendor/sabre/uri/composer.json +++ b/vendor/sabre/uri/composer.json @@ -37,9 +37,12 @@ } }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.9", - "phpstan/phpstan": "^1.8", - "phpunit/phpunit" : "^9.0" + "friendsofphp/php-cs-fixer": "^3.17", + "phpstan/phpstan": "^1.10", + "phpstan/phpstan-phpunit": "^1.3", + "phpstan/phpstan-strict-rules": "^1.5", + "phpstan/extension-installer": "^1.3", + "phpunit/phpunit" : "^9.6" }, "scripts": { "phpstan": [ @@ -56,5 +59,10 @@ "composer cs-fixer", "composer phpunit" ] + }, + "config": { + "allow-plugins": { + "phpstan/extension-installer": true + } } } diff --git a/vendor/sabre/uri/lib/Version.php b/vendor/sabre/uri/lib/Version.php index e4f289e90..a30694f2c 100644 --- a/vendor/sabre/uri/lib/Version.php +++ b/vendor/sabre/uri/lib/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - public const VERSION = '2.3.2'; + public const VERSION = '2.3.3'; } diff --git a/vendor/sabre/uri/lib/functions.php b/vendor/sabre/uri/lib/functions.php index 64e64027f..01ef92d7e 100644 --- a/vendor/sabre/uri/lib/functions.php +++ b/vendor/sabre/uri/lib/functions.php @@ -26,15 +26,15 @@ function resolve(string $basePath, string $newPath): string // If the new path defines a scheme, it's absolute and we can just return // that. - if ($delta['scheme']) { + if (null !== $delta['scheme']) { return build($delta); } $base = parse($basePath); $pick = function ($part) use ($base, $delta) { - if ($delta[$part]) { + if (null !== $delta[$part]) { return $delta[$part]; - } elseif ($base[$part]) { + } elseif (null !== $base[$part]) { return $base[$part]; } @@ -47,7 +47,6 @@ function resolve(string $basePath, string $newPath): string $newParts['host'] = $pick('host'); $newParts['port'] = $pick('port'); - $path = ''; if (is_string($delta['path']) and strlen($delta['path']) > 0) { // If the path starts with a slash if ('/' === $delta['path'][0]) { @@ -62,7 +61,10 @@ function resolve(string $basePath, string $newPath): string $path .= '/'.$delta['path']; } } else { - $path = $base['path'] ?: '/'; + $path = $base['path'] ?? '/'; + if ('' === $path) { + $path = '/'; + } } // Removing .. and . $pathParts = explode('/', $path); @@ -85,13 +87,17 @@ function resolve(string $basePath, string $newPath): string // If the source url ended with a /, we want to preserve that. $newParts['path'] = 0 === strpos($path, '/') ? $path : '/'.$path; - if ($delta['query']) { + // From PHP 8, no "?" query at all causes 'query' to be null. + // An empty query "http://example.com/foo?" causes 'query' to be the empty string + if (null !== $delta['query'] && '' !== $delta['query']) { $newParts['query'] = $delta['query']; - } elseif (!empty($base['query']) && empty($delta['host']) && empty($delta['path'])) { + } elseif (isset($base['query']) && null === $delta['host'] && null === $delta['path']) { // Keep the old query if host and path didn't change $newParts['query'] = $base['query']; } - if ($delta['fragment']) { + // From PHP 8, no "#" fragment at all causes 'fragment' to be null. + // An empty fragment "http://example.com/foo#" causes 'fragment' to be the empty string + if (null !== $delta['fragment'] && '' !== $delta['fragment']) { $newParts['fragment'] = $delta['fragment']; } @@ -113,7 +119,7 @@ function normalize(string $uri): string { $parts = parse($uri); - if (!empty($parts['path'])) { + if (null !== $parts['path']) { $pathParts = explode('/', ltrim($parts['path'], '/')); $newPathParts = []; foreach ($pathParts as $pathPart) { @@ -134,14 +140,14 @@ function normalize(string $uri): string $parts['path'] = '/'.implode('/', $newPathParts); } - if ($parts['scheme']) { + if (null !== $parts['scheme']) { $parts['scheme'] = strtolower($parts['scheme']); $defaultPorts = [ 'http' => '80', 'https' => '443', ]; - if (!empty($parts['port']) && isset($defaultPorts[$parts['scheme']]) && $defaultPorts[$parts['scheme']] == $parts['port']) { + if (null !== $parts['port'] && isset($defaultPorts[$parts['scheme']]) && $defaultPorts[$parts['scheme']] == $parts['port']) { // Removing default ports. unset($parts['port']); } @@ -149,7 +155,7 @@ function normalize(string $uri): string switch ($parts['scheme']) { case 'http': case 'https': - if (empty($parts['path'])) { + if (null === $parts['path']) { // An empty path is equivalent to / in http. $parts['path'] = '/'; } @@ -157,7 +163,7 @@ function normalize(string $uri): string } } - if ($parts['host']) { + if (null !== $parts['host']) { $parts['host'] = strtolower($parts['host']); } @@ -201,7 +207,7 @@ function parse(string $uri): array } $result = parse_url($uri); - if (!$result) { + if (false === $result) { $result = _parse_fallback($uri); } @@ -238,32 +244,32 @@ function build(array $parts): string $uri = ''; $authority = ''; - if (!empty($parts['host'])) { + if (isset($parts['host'])) { $authority = $parts['host']; - if (!empty($parts['user'])) { + if (isset($parts['user'])) { $authority = $parts['user'].'@'.$authority; } - if (!empty($parts['port'])) { + if (isset($parts['port'])) { $authority = $authority.':'.$parts['port']; } } - if (!empty($parts['scheme'])) { + if (isset($parts['scheme'])) { // If there's a scheme, there's also a host. $uri = $parts['scheme'].':'; } - if ($authority || (!empty($parts['scheme']) && 'file' === $parts['scheme'])) { + if ('' !== $authority || (isset($parts['scheme']) && 'file' === $parts['scheme'])) { // No scheme, but there is a host. $uri .= '//'.$authority; } - if (!empty($parts['path'])) { + if (isset($parts['path'])) { $uri .= $parts['path']; } - if (!empty($parts['query'])) { + if (isset($parts['query'])) { $uri .= '?'.$parts['query']; } - if (!empty($parts['fragment'])) { + if (isset($parts['fragment'])) { $uri .= '#'.$parts['fragment']; } @@ -290,7 +296,7 @@ function build(array $parts): string function split(string $path): array { $matches = []; - if (preg_match('/^(?:(?:(.*)(?:\/+))?([^\/]+))(?:\/?)$/u', $path, $matches)) { + if (1 === preg_match('/^(?:(?:(.*)(?:\/+))?([^\/]+))(?:\/?)$/u', $path, $matches)) { return [$matches[1], $matches[2]]; } @@ -307,7 +313,7 @@ function split(string $path): array * This function is only called if the main parse method fails. It's pretty * crude and probably slow, so the original parse_url is usually preferred. * - * @return array + * @return array{scheme: string|null, host: string|null, path: string|null, port: positive-int|null, user: string|null, query: string|null, fragment: string|null} * * @throws InvalidUriException */ @@ -340,10 +346,14 @@ function _parse_fallback(string $uri): array 'query' => null, ]; - if (preg_match('% ^([A-Za-z][A-Za-z0-9+-\.]+): %x', $uri, $matches)) { + if (1 === preg_match('% ^([A-Za-z][A-Za-z0-9+-\.]+): %x', $uri, $matches)) { $result['scheme'] = $matches[1]; // Take what's left. $uri = substr($uri, strlen($result['scheme']) + 1); + if (false === $uri) { + // There was nothing left. + $uri = ''; + } } // Taking off a fragment part @@ -358,7 +368,11 @@ function _parse_fallback(string $uri): array if ('///' === substr($uri, 0, 3)) { // The triple slash uris are a bit unusual, but we have special handling // for them. - $result['path'] = substr($uri, 2); + $path = substr($uri, 2); + if (false === $path) { + throw new \RuntimeException('The string cannot be false'); + } + $result['path'] = $path; $result['host'] = ''; } elseif ('//' === substr($uri, 0, 2)) { // Uris that have an authority part. @@ -369,22 +383,25 @@ function _parse_fallback(string $uri): array (?: : (? [0-9]+))? (? / .*)? $%x'; - if (!preg_match($regex, $uri, $matches)) { + if (1 !== preg_match($regex, $uri, $matches)) { throw new InvalidUriException('Invalid, or could not parse URI'); } - if ($matches['host']) { + if (isset($matches['host']) && '' !== $matches['host']) { $result['host'] = $matches['host']; } if (isset($matches['port'])) { - $result['port'] = (int) $matches['port']; + $port = (int) $matches['port']; + if ($port > 0) { + $result['port'] = $port; + } } if (isset($matches['path'])) { $result['path'] = $matches['path']; } - if ($matches['user']) { + if (isset($matches['user']) && '' !== $matches['user']) { $result['user'] = $matches['user']; } - if ($matches['pass']) { + if (isset($matches['pass']) && '' !== $matches['pass']) { $result['pass'] = $matches['pass']; } } else { diff --git a/vendor/sabre/xml/lib/Deserializer/functions.php b/vendor/sabre/xml/lib/Deserializer/functions.php index c4f240970..62d4d0e07 100644 --- a/vendor/sabre/xml/lib/Deserializer/functions.php +++ b/vendor/sabre/xml/lib/Deserializer/functions.php @@ -216,7 +216,7 @@ function valueObject(Reader $reader, string $className, string $namespace) $reader->next(); } } else { - if (!$reader->read()) { + if (Reader::END_ELEMENT !== $reader->nodeType && !$reader->read()) { break; } } diff --git a/vendor/sabre/xml/lib/Version.php b/vendor/sabre/xml/lib/Version.php index 1144bf085..6b6c53b18 100644 --- a/vendor/sabre/xml/lib/Version.php +++ b/vendor/sabre/xml/lib/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - const VERSION = '2.2.5'; + const VERSION = '2.2.6'; } -- cgit v1.2.3