From 56de676d48e04c5bced98a5773b83e66dac21008 Mon Sep 17 00:00:00 2001 From: marcus Date: Fri, 27 Jun 2008 12:10:04 +0000 Subject: Short circuited query if could not possibly return a value. Refs #101 git-svn-id: https://code.elgg.org/elgg/trunk@1175 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/entities.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/lib/entities.php b/engine/lib/entities.php index c76e8d970..d0c637a3f 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -791,6 +791,8 @@ $subtype_id = (int)$subtype_id; + if (!$subtype_id) return false; + $result = get_data_row("SELECT * from {$CONFIG->dbprefix}entity_subtypes where id=$subtype_id"); if ($result) return $result->subtype; @@ -829,7 +831,9 @@ { global $CONFIG; - $subtype = (int)$subtype_id; + $subtype_id = (int)$subtype_id; + + if (!$subtype_id) return false; $result = get_data_row("SELECT * from {$CONFIG->dbprefix}entity_subtypes where id=$subtype_id"); if ($result) -- cgit v1.2.3