From 2bf93dc0345e304656ed9a931f9941fd7117ddfe Mon Sep 17 00:00:00 2001 From: Nicolas Frandeboeuf Date: Thu, 22 Aug 2013 00:49:23 +0200 Subject: [PATCH] Fix #149 --- inc/poche/Url.class.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/inc/poche/Url.class.php b/inc/poche/Url.class.php index 00b0b257..77ed5398 100644 --- a/inc/poche/Url.class.php +++ b/inc/poche/Url.class.php @@ -64,8 +64,15 @@ class Url if (function_exists('tidy_parse_string')) { $tidy = tidy_parse_string($html, array(), 'UTF8'); $tidy->cleanRepair(); - $html = $tidy->value; - } + + //Warning: tidy might fail so, ensure there is still a content + $body = $tidy->body(); + + //hasChildren does not seem to work, just check the string + //returned (and do not forget to clean the white spaces) + if (preg_replace('/\s+/', '', $body->value) !== "") + $html = $tidy->value; + } $parameters = array(); if (isset($html) and strlen($html) > 0) -- 2.41.0