viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

Fix a bug in RssProcessor regarding feeds with only one element, Fix a bug in ImmpressionModel concerning undefined variable db, fix FetchUrl error that could occur with old version of cURL, fix notice in NamedEntityContextTagger, a=chris

Chris Pollett [2020-07-13 23:Jul:th]
Fix a bug in RssProcessor regarding feeds with only one element, Fix a bug in ImmpressionModel concerning undefined variable db, fix FetchUrl error that could occur with old version of cURL, fix notice in NamedEntityContextTagger, a=chris
Filename
src/library/FetchUrl.php
src/library/NamedEntityContextTagger.php
src/library/processors/RssProcessor.php
src/models/ImpressionModel.php
src/views/layouts/WebLayout.php
diff --git a/src/library/FetchUrl.php b/src/library/FetchUrl.php
index 42074ec88..1ab6f9efe 100755
--- a/src/library/FetchUrl.php
+++ b/src/library/FetchUrl.php
@@ -169,7 +169,7 @@ class FetchUrl implements CrawlConstants
                                 */
             }
             curl_setopt($sites[$i][0], CURLOPT_FOLLOWLOCATION, $follow);
-            if ($scheme == "https") {
+            if ($scheme == "https" && defined("CURL_HTTP_VERSION_2_0")) {
                 curl_setopt($sites[$i][0], CURLOPT_HTTP_VERSION,
                     CURL_HTTP_VERSION_2_0);
             }
diff --git a/src/library/NamedEntityContextTagger.php b/src/library/NamedEntityContextTagger.php
index 3a9768d28..6553f3115 100644
--- a/src/library/NamedEntityContextTagger.php
+++ b/src/library/NamedEntityContextTagger.php
@@ -367,9 +367,9 @@ class NamedEntityContextTagger extends ContextTagger
                 }
                 if ($tags[$i] != "o") {
                     if ($current_entity) {
-                        $current_entity .= $characters[$i];
+                        $current_entity .= $characters[$i] ?? "";
                     } else {
-                        $current_entity = $characters[$i];
+                        $current_entity = $characters[$i] ?? "";
                     }
                 }
                 $pre_tag = $tags[$i];
diff --git a/src/library/processors/RssProcessor.php b/src/library/processors/RssProcessor.php
index bd9c167bb..a73ae5289 100644
--- a/src/library/processors/RssProcessor.php
+++ b/src/library/processors/RssProcessor.php
@@ -323,7 +323,7 @@ class RssProcessor extends TextProcessor
         }
         if (count($info) == 1) {
             $info = array_values($info);
-            $info = mb_ereg_replace("(\s)+", " ",  $info[0]);
+            $info[0] = mb_ereg_replace("(\s)+", " ",  $info[0]);
         }
         return [$url, $info];
     }
diff --git a/src/models/ImpressionModel.php b/src/models/ImpressionModel.php
index e65c89340..ad8fd7828 100644
--- a/src/models/ImpressionModel.php
+++ b/src/models/ImpressionModel.php
@@ -399,11 +399,11 @@ class ImpressionModel extends Model
         $row = $this->db->fetchArray($result);
         if (empty($row)) {
             $periods = [C\ONE_HOUR, C\ONE_DAY, C\ONE_MONTH, C\ONE_YEAR,
-                            C\FOREVER];
+                C\FOREVER];
             foreach ($periods as $period) {
                 $sql = "INSERT INTO ITEM_IMPRESSION_STAT VALUES
-                        (?, ?, ?, -1, -1)";
-                $db->execute($sql, [$item_id, $type_id, $period]);
+                    (?, ?, ?, -1, -1)";
+                $this->db->execute($sql, [$item_id, $type_id, $period]);
             }
             return [-1, -1];
         }
diff --git a/src/views/layouts/WebLayout.php b/src/views/layouts/WebLayout.php
index ebfa7ec39..4d0439d89 100755
--- a/src/views/layouts/WebLayout.php
+++ b/src/views/layouts/WebLayout.php
@@ -79,7 +79,7 @@ class WebLayout extends Layout
             e(tl('web_layout_description'));
         } ?>" />
         <meta name="Author" content="<?=tl('web_layout_site_author') ?>" />
-        <meta name="referrer" content="origin-when-cross-origin" />
+        <meta name="referrer" content="strict-origin-when-cross-origin" />
         <meta charset="utf-8" /><?php
         if ($_SERVER["MOBILE"]) {?>
             <meta name="viewport"
ViewGit