aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorJanek Lasocki-Biczysko <j.lasocki-biczysko@intrallect.com>2011-12-06 11:15:14 +0000
committerCash Costello <cash.costello@gmail.com>2011-12-07 07:28:28 -0500
commit7591e47ca63159e6324090bde7063ba53af8bfe6 (patch)
treecdc00831fbac30e2b0d9a0d690a93b67d85a14d7 /engine/lib
parentf1c8a2dadee9a31bf941b92eb3f4030b4f89d191 (diff)
downloadelgg-7591e47ca63159e6324090bde7063ba53af8bfe6.tar.gz
elgg-7591e47ca63159e6324090bde7063ba53af8bfe6.tar.bz2
#4187 (get_entity optimization)
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/entities.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index dbb5ee695..daced6740 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -669,7 +669,10 @@ function get_entity($guid) {
static $newentity_cache;
$new_entity = false;
- if (!is_numeric($guid)) {
+ // We could also use: if (!(int) $guid) { return FALSE },
+ // but that evaluates to a false positive for $guid = TRUE.
+ // This is a bit slower, but more thorough.
+ if (!is_numeric($guid) || $guid === 0 || $guid === '0') {
return FALSE;
}