summaryrefslogtreecommitdiff
path: root/classes/urlhelper.php
diff options
context:
space:
mode:
authorwn_ <[email protected]>2022-08-12 14:16:40 +0000
committerwn_ <[email protected]>2022-08-12 14:16:40 +0000
commit7567676ed8c2d72bdff626380ee038bdc2dbb39c (patch)
treefff498657228f26187c7be10aac09453e92ccd6c /classes/urlhelper.php
parent93fd85df6f73732d3a6ed280d26224e1877c954f (diff)
Remove a PHP < 7.1 branch in UrlHelper.
Diffstat (limited to 'classes/urlhelper.php')
-rw-r--r--classes/urlhelper.php42
1 files changed, 18 insertions, 24 deletions
diff --git a/classes/urlhelper.php b/classes/urlhelper.php
index da812d422..5ccaaf2da 100644
--- a/classes/urlhelper.php
+++ b/classes/urlhelper.php
@@ -190,32 +190,26 @@ class UrlHelper {
if ($nest > 10)
return false;
- if (version_compare(PHP_VERSION, '7.1.0', '>=')) {
- $context_options = array(
- 'http' => array(
- 'header' => array(
- 'Connection: close'
- ),
- 'method' => 'HEAD',
- 'timeout' => $timeout,
- 'protocol_version'=> 1.1)
- );
-
- if (Config::get(Config::HTTP_PROXY)) {
- $context_options['http']['request_fulluri'] = true;
- $context_options['http']['proxy'] = Config::get(Config::HTTP_PROXY);
- }
+ $context_options = array(
+ 'http' => array(
+ 'header' => array(
+ 'Connection: close'
+ ),
+ 'method' => 'HEAD',
+ 'timeout' => $timeout,
+ 'protocol_version'=> 1.1)
+ );
+
+ if (Config::get(Config::HTTP_PROXY)) {
+ $context_options['http']['request_fulluri'] = true;
+ $context_options['http']['proxy'] = Config::get(Config::HTTP_PROXY);
+ }
- $context = stream_context_create($context_options);
+ $context = stream_context_create($context_options);
- // PHP 8 changed the second param from int to bool, but we still support PHP >= 7.1.0
- // @phpstan-ignore-next-line
- $headers = get_headers($url, 0, $context);
- } else {
- // PHP 8 changed the second param from int to bool, but we still support PHP >= 7.1.0
- // @phpstan-ignore-next-line
- $headers = get_headers($url, 0);
- }
+ // PHP 8 changed the second param from int to bool, but we still support PHP >= 7.4.0
+ // @phpstan-ignore-next-line
+ $headers = get_headers($url, 0, $context);
if (is_array($headers)) {
$headers = array_reverse($headers); // last one is the correct one