From e7d2d27938ceaa40f7cd77cf3a28d66bf20d0291 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 17 May 2018 07:35:58 +0200 Subject: [PATCH] sizeof bug sizeof cannot be used to test existance. Fixes: Got error 'PHP message: PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in /.../include/items.php on line 66\n': 1 Time(s) PHP 7.2.5 / Ubuntu 17.04 LTS --- include/items.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/items.php b/include/items.php index af13898b24..c04bef01c3 100644 --- a/include/items.php +++ b/include/items.php @@ -29,7 +29,7 @@ function add_page_info_data($data, $no_photos = false) { // It maybe is a rich content, but if it does have everything that a link has, // then treat it that way if (($data["type"] == "rich") && is_string($data["title"]) && - is_string($data["text"]) && (sizeof($data["images"]) > 0)) { + is_string($data["text"]) && !empty($data["images"])) { $data["type"] = "link"; } @@ -63,7 +63,7 @@ function add_page_info_data($data, $no_photos = false) { $text .= " title='".$data["title"]."'"; } - if (sizeof($data["images"]) > 0) { + if (!empty($data["images"])) { $preview = str_replace(["[", "]"], ["[", "]"], htmlentities($data["images"][0]["src"], ENT_QUOTES, 'UTF-8', false)); // if the preview picture is larger than 500 pixels then show it in a larger mode // But only, if the picture isn't higher than large (To prevent huge posts)