]> git.mxchange.org Git - friendica-addons.git/commitdiff
return 0 from get_body_length before loading the body to DomDocument if body is empty
authorDomovoy <domovoy@errlock.org>
Fri, 27 Jul 2012 08:08:30 +0000 (10:08 +0200)
committerDomovoy <domovoy@errlock.org>
Fri, 27 Jul 2012 08:08:30 +0000 (10:08 +0200)
showmore/showmore.php

index 096fd3f704b69e3f825daeffdc84048967e4beb0..de8c2f0740eca7bb9c8af9daab40154289641551 100755 (executable)
@@ -69,10 +69,15 @@ function showmore_addon_settings_post(&$a,&$b) {
 function get_body_length($body) {
        $string = trim($body);
 
+       // DomDocument doesn't like empty strings
+       if(! strlen($string)) {
+               return 0;
+       }
+
        // We need to get rid of hidden tags (display: none)
 
        // Get rid of the warning. It would be better to have some valid html as input
-       $dom = @DomDocument::loadHTML($body);
+       $dom = DomDocument::loadHTML($body);
        $xpath = new DOMXPath($dom);
 
        /*