From 863617013cb0c06fda7bca601693fce050cf8e6f Mon Sep 17 00:00:00 2001 From: Vasudev Kamath Date: Sun, 22 Jul 2012 12:41:07 +0530 Subject: [PATCH] Access image part of siteinfo only if $siteinfo["images"] is actually set. The current code didn't check this so I was getting an error Warning: Invalid argument supplied for foreach() in /home/vasudev/Public/friendica/mod/parse_url.php on line 305 Implemented a check before accessing $siteinfo["images"] with this commit and now warning doesn't come when giving URL of a site which doesn't have image from link button of post area --- mod/parse_url.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mod/parse_url.php b/mod/parse_url.php index 0610531967..5dd7de750b 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -302,11 +302,16 @@ function parse_url_content(&$a) { $image = ""; - foreach ($siteinfo["images"] as $imagedata) + if($siteinfo["image"] != ""){ + /* + Execute below code only if image is present in siteinfo + */ + foreach ($siteinfo["images"] as $imagedata) if($textmode) - $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]'; + $image .= '[img='.$imagedata["width"].'x'.$imagedata["height"].']'.$imagedata["src"].'[/img]'; else - $image .= 'photo'; + $image .= 'photo'; + } if(strlen($text)) { if($textmode) -- 2.39.5