From ea1997128529965fa92f1a182c2a7ad02b88d3e3 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Wed, 31 May 2017 23:12:55 +0200 Subject: :arrow_up:Update Sabre libraries. --- vendor/sabre/uri/.travis.yml | 2 +- vendor/sabre/uri/CHANGELOG.md | 23 +++++++ vendor/sabre/uri/LICENSE | 2 +- vendor/sabre/uri/README.md | 8 --- vendor/sabre/uri/composer.json | 4 +- vendor/sabre/uri/lib/InvalidUriException.php | 17 +++++ vendor/sabre/uri/lib/Version.php | 2 +- vendor/sabre/uri/lib/functions.php | 99 ++++++++++++++++++++++++++-- 8 files changed, 140 insertions(+), 17 deletions(-) create mode 100644 vendor/sabre/uri/lib/InvalidUriException.php (limited to 'vendor/sabre/uri') diff --git a/vendor/sabre/uri/.travis.yml b/vendor/sabre/uri/.travis.yml index f7d1a0657..75c8270df 100644 --- a/vendor/sabre/uri/.travis.yml +++ b/vendor/sabre/uri/.travis.yml @@ -3,8 +3,8 @@ php: - 5.4 - 5.5 - 5.6 - - hhvm - 7 + - 7.1 script: - ./bin/phpunit --configuration tests/phpunit.xml.dist diff --git a/vendor/sabre/uri/CHANGELOG.md b/vendor/sabre/uri/CHANGELOG.md index 9fa510dc2..92aaa7507 100644 --- a/vendor/sabre/uri/CHANGELOG.md +++ b/vendor/sabre/uri/CHANGELOG.md @@ -1,6 +1,29 @@ ChangeLog ========= +1.2.1 (2017-02-20) +------------------ + +* #16: Correctly parse urls that are only a fragment `#`. + + +1.2.0 (2016-12-06) +------------------ + +* Now throwing `InvalidUriException` if a uri passed to the `parse` function + is invalid or could not be parsed. +* #11: Fix support for URIs that start with a triple slash. PHP's `parse_uri()` + doesn't support them, so we now have a pure-php fallback in case it fails. +* #9: Fix support for relative URI's that have a non-uri encoded colon `:` in + them. + + +1.1.1 (2016-10-27) +------------------ + +* #10: Correctly support file:// URIs in the build() method. (@yuloh) + + 1.1.0 (2016-03-07) ------------------ diff --git a/vendor/sabre/uri/LICENSE b/vendor/sabre/uri/LICENSE index 9a3a91946..087996be7 100644 --- a/vendor/sabre/uri/LICENSE +++ b/vendor/sabre/uri/LICENSE @@ -1,4 +1,4 @@ -Copyright (C) 2014-2016 fruux GmbH (https://fruux.com/) +Copyright (C) 2014-2017 fruux GmbH (https://fruux.com/) All rights reserved. diff --git a/vendor/sabre/uri/README.md b/vendor/sabre/uri/README.md index 76f55d8e4..aa21bfe06 100644 --- a/vendor/sabre/uri/README.md +++ b/vendor/sabre/uri/README.md @@ -25,14 +25,6 @@ Further reading * [Usage][8] -Build status ------------- - -| branch | status | -| ------ | ------ | -| master | [![Build Status](https://travis-ci.org/fruux/sabre-uri.svg?branch=master)](https://travis-ci.org/fruux/sabre-uri) | - - Questions? ---------- diff --git a/vendor/sabre/uri/composer.json b/vendor/sabre/uri/composer.json index 7b48acb71..49d69e723 100644 --- a/vendor/sabre/uri/composer.json +++ b/vendor/sabre/uri/composer.json @@ -32,8 +32,8 @@ } }, "require-dev": { - "sabre/cs": "~0.0.1", - "phpunit/phpunit" : "*" + "sabre/cs": "~1.0.0", + "phpunit/phpunit" : ">=4.0,<6.0" }, "config" : { "bin-dir" : "bin/" diff --git a/vendor/sabre/uri/lib/InvalidUriException.php b/vendor/sabre/uri/lib/InvalidUriException.php new file mode 100644 index 000000000..0385fd462 --- /dev/null +++ b/vendor/sabre/uri/lib/InvalidUriException.php @@ -0,0 +1,17 @@ + null, 'host' => null, 'path' => null, @@ -233,7 +238,7 @@ function build(array $parts) { $uri = $parts['scheme'] . ':'; } - if ($authority) { + if ($authority || (!empty($parts['scheme']) && $parts['scheme'] === 'file')) { // No scheme, but there is a host. $uri .= '//' . $authority; @@ -280,3 +285,89 @@ function split($path) { return [null,null]; } + +/** + * This function is another implementation of parse_url, except this one is + * fully written in PHP. + * + * The reason is that the PHP bug team is not willing to admit that there are + * bugs in the parse_url implementation. + * + * 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. + * + * @param string $uri + * @return array + */ +function _parse_fallback($uri) { + + // Normally a URI must be ASCII, however. However, often it's not and + // parse_url might corrupt these strings. + // + // For that reason we take any non-ascii characters from the uri and + // uriencode them first. + $uri = preg_replace_callback( + '/[^[:ascii:]]/u', + function($matches) { + return rawurlencode($matches[0]); + }, + $uri + ); + + $result = [ + 'scheme' => null, + 'host' => null, + 'port' => null, + 'user' => null, + 'path' => null, + 'fragment' => null, + 'query' => null, + ]; + + if (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); + + } + + // Taking off a fragment part + if (strpos($uri, '#') !== false) { + list($uri, $result['fragment']) = explode('#', $uri, 2); + } + // Taking off the query part + if (strpos($uri, '?') !== false) { + list($uri, $result['query']) = explode('?', $uri, 2); + } + + 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); + $result['host'] = ''; + } elseif (substr($uri, 0, 2) === '//') { + // Uris that have an authority part. + $regex = ' + %^ + // + (?: (? [^:@]+) (: (? [^@]+)) @)? + (? ( [^:/]* | \[ [^\]]+ \] )) + (?: : (? [0-9]+))? + (? / .*)? + $%x + '; + if (!preg_match($regex, $uri, $matches)) { + throw new InvalidUriException('Invalid, or could not parse URI'); + } + if ($matches['host']) $result['host'] = $matches['host']; + if ($matches['port']) $result['port'] = (int)$matches['port']; + if (isset($matches['path'])) $result['path'] = $matches['path']; + if ($matches['user']) $result['user'] = $matches['user']; + if ($matches['pass']) $result['pass'] = $matches['pass']; + } else { + $result['path'] = $uri; + } + + return $result; +} -- cgit v1.2.3