diff options
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | classes/UrlHelper.php | 10 | ||||
| -rw-r--r-- | phpunit.xml | 21 |
3 files changed, 21 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore index 9a0c6e9f0..249cb8c71 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,6 @@ Thumbs.db /lock/* /.vscode/settings.json /vendor/**/.git -/.phpunit.result.cache +/.phpunit.cache /.phpstan-tmp /.tools/ diff --git a/classes/UrlHelper.php b/classes/UrlHelper.php index 7e793be46..53030299d 100644 --- a/classes/UrlHelper.php +++ b/classes/UrlHelper.php @@ -223,11 +223,12 @@ class UrlHelper { } /** + * @todo the multiple-argument approach has been deprecated for a long time, and should be removed + * @todo validate options + * * @param array<string, bool|int|string>|string $options * @return false|string false if something went wrong, otherwise string contents */ - // TODO: max_size currently only works for CURL transfers - // TODO: multiple-argument way is deprecated, first parameter is a hash now public static function fetch(array|string $options /* previously: 0: $url , 1: $type = false, 2: $login = false, 3: $pass = false, 4: $post_query = false, 5: $timeout = false, 6: $timestamp = 0, 7: $useragent = false, 8: $encoding = false, 9: $auth_type = "basic" */): false|string { @@ -281,10 +282,9 @@ class UrlHelper { $http_referrer = $options["http_referrer"] ?? false; $encoding = $options["encoding"] ?? false; - $url = ltrim($url, ' '); - $url = str_replace(' ', '%20', $url); + $url = str_replace(' ', '%20', ltrim($url ?? '', ' ')); - Debug::log("[UrlHelper] fetching: $url", Debug::LOG_EXTENDED); + Debug::log("[UrlHelper] handling URL: $url", Debug::LOG_EXTENDED); $url = self::validate($url, true); diff --git a/phpunit.xml b/phpunit.xml index 20a3e63ea..c4163695f 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,14 +1,23 @@ -<phpunit - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.0/phpunit.xsd" +<?xml version="1.0" encoding="UTF-8"?> +<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/12.4/phpunit.xsd" bootstrap="tests/autoload.php" cacheDirectory=".phpunit.cache" executionOrder="depends,defects" beStrictAboutOutputDuringTests="true" + displayDetailsOnPhpunitDeprecations="true" + failOnPhpunitDeprecation="true" failOnRisky="true" failOnWarning="true"> - <testsuite name="tt-rss"> - <directory>tests</directory> - </testsuite> + <testsuites> + <testsuite name="default"> + <directory>tests</directory> + </testsuite> + </testsuites> + <source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true"> + <include> + <directory>classes</directory> + </include> + </source> </phpunit> |