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

Fix notice in network iterator time calculation, a=chris

Chris Pollett [2020-07-16 17:Jul:th]
Fix notice in network iterator time calculation, a=chris
Filename
src/controllers/SearchController.php
src/library/index_bundle_iterators/NetworkIterator.php
diff --git a/src/controllers/SearchController.php b/src/controllers/SearchController.php
index 798fccecc..9ecee9dd2 100755
--- a/src/controllers/SearchController.php
+++ b/src/controllers/SearchController.php
@@ -2096,10 +2096,9 @@ EOD;
             $cache_file = L\utf8WordWrap($cache_file, 80);
             $cache_file = "<html><head><title>".
                 tl('search_controller_site_cache') . "</title></head>".
-                "<body>".$cache_file."</body></html>";
+                "<body>" . $cache_file . "</body></html>";
             $dom = L\getDomFromString($cache_file);
         }
-        set_error_handler(C\NS_CONFIGS . "yioop_error_handler");
         $body =  $dom->getElementsByTagName('body')->item(0);
         if (!$body) {
             return $cache_file;
@@ -2153,7 +2152,8 @@ EOD;
             $version_node->appendChild($history_node);
         }
         $body = $this->markChildren($body, $words, $dom);
-        $new_doc = $dom->saveHTML();
+        $new_doc = @$dom->saveHTML();
+        set_error_handler(C\NS_CONFIGS . "yioop_error_handler");
         if (substr($url, 0, 7) != "record:") {
             $url = "<a href='$url'>$url</a>";
         }
diff --git a/src/library/index_bundle_iterators/NetworkIterator.php b/src/library/index_bundle_iterators/NetworkIterator.php
index 7839255f2..47050ed89 100644
--- a/src/library/index_bundle_iterators/NetworkIterator.php
+++ b/src/library/index_bundle_iterators/NetworkIterator.php
@@ -260,7 +260,7 @@ class NetworkIterator extends IndexBundleIterator
                         }
                     }
                 }
-                $max_time = max($max_time, $pre_result['TOTAL_TIME']);
+                $max_time = max($max_time, $pre_result['TOTAL_TIME'] ?? 0);
                 $machine_times .= $in4 . $lookup_link . " ".
                     number_format($pre_result['ELAPSED_TIME'], 6) . "/" .
                     number_format($pre_result['TOTAL_TIME'], 6) . "<br />";
ViewGit