From: Janek Lasocki-Biczysko Date: Tue, 6 Dec 2011 11:15:14 +0000 (+0000) Subject: #4187 (get_entity optimization) X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=7591e47ca63159e6324090bde7063ba53af8bfe6;p=lorea%2Felgg.git #4187 (get_entity optimization) --- 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; }