From: Jonny Tischbein Date: Sat, 17 Nov 2018 12:22:32 +0000 (+0100) Subject: Fix SQL Error if no items where found + Fix setting to null X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=56406b99101b6f8a45ffc910b353c52bf77c5523;p=friendica.git Fix SQL Error if no items where found + Fix setting to null --- diff --git a/mod/network.php b/mod/network.php index 37c7b45286..bfd5e9e872 100644 --- a/mod/network.php +++ b/mod/network.php @@ -346,7 +346,11 @@ function networkConversation(App $a, $items, Pager $pager, $mode, $update, $orde // Set this so that the conversation function can find out contact info for our wall-wall items $a->page_contact = $a->contact; - $items = (empty($items) ? [] : $items); + if (!is_array($items)){ + Logger::log("Expecting items to be an array. Got " . print_r($items, true)); + $items = []; + } + $o = conversation($a, $items, $pager, $mode, $update, false, $ordering, local_user()); if (!$update) { @@ -390,6 +394,10 @@ function network_content(App $a, $update = 0, $parent = 0) $o = networkThreadedView($a, $update, $parent); } + if ($o === ''){ + info("No items found"); + } + return $o; } @@ -464,6 +472,9 @@ function networkFlatView(App $a, $update = 0) } DBA::close($result); + if (count($posts) == 0){ + return ''; + } $condition = ['uid' => local_user(), 'id' => $posts]; } else { $condition = ['uid' => local_user()]; diff --git a/src/Model/FileTag.php b/src/Model/FileTag.php index b5c4cf2aef..403cbd233e 100644 --- a/src/Model/FileTag.php +++ b/src/Model/FileTag.php @@ -290,7 +290,11 @@ class FileTag return false; } - $fields = ['file' => str_replace($pattern, null, $item['file'])]; + $fields = ['file' => str_replace($pattern, '', $item['file'])]; + if ($fields === '') { + $fields = null; + } + Item::update($fields, ['id' => $item_id]); $r = q("SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d",