From: Andrew Dolgov <noreply@fakecake.org>
Date: Sun, 12 Jul 2015 11:23:32 +0000 (+0300)
Subject: apparently it's a bad idea to do is_resource() on a mysqli result
X-Git-Tag: 16.3~232^2~9
X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=ec57104d6e221a2a44752d6f68615055eefea1db;p=tt-rss.git

apparently it's a bad idea to do is_resource() on a mysqli result
---

diff --git a/classes/api.php b/classes/api.php
index 2691625c..648d6ca6 100644
--- a/classes/api.php
+++ b/classes/api.php
@@ -700,7 +700,7 @@ class API extends Handler {
 				'id' => $feed_id,
 				'is_cat' => $is_cat);
 
-			if (is_resource($result)) {
+			if (!is_numeric($result)) {
 				while ($line = db_fetch_assoc($result)) {
 					$line["content_preview"] = truncate_string(strip_tags($line["content"]), $excerpt_length);
 					foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
diff --git a/classes/feeds.php b/classes/feeds.php
index d1caf3c2..508ad988 100644
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -295,7 +295,7 @@ class Feeds extends Handler_Protected {
 			}
 		}
 
-		if (is_resource($result) && $this->dbh->num_rows($result) > 0) {
+		if (!is_numeric($result) && $this->dbh->num_rows($result) > 0) {
 
 			$lnum = $offset;
 
@@ -753,7 +753,7 @@ class Feeds extends Handler_Protected {
 
 			if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PE", $timing_info);
 
-		} else if (is_resource($result)) {
+		} else if (!is_numeric($result)) {
 			$message = "";
 
 			switch ($view_mode) {