]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fix PHP warning 3909/head
authorJeremy Benoist <jeremy.benoist@gmail.com>
Mon, 18 Mar 2019 05:23:41 +0000 (06:23 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Mon, 18 Mar 2019 05:23:41 +0000 (06:23 +0100)
Looks like sometimes (usually from import) the `html` key isn’t available.

src/Wallabag/CoreBundle/Helper/ContentProxy.php

index d38811a272caa13b0ed859a99ee394c64e93b831..31953f12d3ef947babfdd1d860c63939d3643abc 100644 (file)
@@ -256,18 +256,17 @@ class ContentProxy
             $entry->setTitle($content['open_graph']['og_title']);
         }
 
-        $html = $content['html'];
-        if (false === $html) {
-            $html = $this->fetchingErrorMessage;
+        if (empty($content['html'])) {
+            $content['html'] = $this->fetchingErrorMessage;
 
             if (!empty($content['open_graph']['og_description'])) {
-                $html .= '<p><i>But we found a short description: </i></p>';
-                $html .= $content['open_graph']['og_description'];
+                $content['html'] .= '<p><i>But we found a short description: </i></p>';
+                $content['html'] .= $content['open_graph']['og_description'];
             }
         }
 
-        $entry->setContent($html);
-        $entry->setReadingTime(Utils::getReadingTime($html));
+        $entry->setContent($content['html']);
+        $entry->setReadingTime(Utils::getReadingTime($content['html']));
 
         if (!empty($content['status'])) {
             $entry->setHttpStatus($content['status']);