diff options
| author | Greg <supahgreg@users.noreply.github.com> | 2025-10-11 16:30:42 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-11 16:30:42 -0500 |
| commit | 5fb013d268c65f16a535ecc924f1480f07b4f011 (patch) | |
| tree | 5fb6d8efebb4b664c59180f61e975289bbab9388 /classes | |
| parent | 73e6ade27f9751d3892693be9e11946462e10ed5 (diff) | |
| parent | 7ad6c3ec641d0b89d072dc9b32202aebb8ecaf8d (diff) | |
Merge pull request #40 from tt-rss/project-cleanup
Project cleanup, PHPUnit config tweaks
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/UrlHelper.php | 10 |
1 files changed, 5 insertions, 5 deletions
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); |