]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
#4187 (get_entity optimization)
authorJanek Lasocki-Biczysko <j.lasocki-biczysko@intrallect.com>
Tue, 6 Dec 2011 11:15:14 +0000 (11:15 +0000)
committerCash Costello <cash.costello@gmail.com>
Wed, 7 Dec 2011 12:28:28 +0000 (07:28 -0500)
engine/lib/entities.php

index dbb5ee69557b6a1323d64edd33d5074b0a95cf60..daced6740e3f0276c1ca111cedb5f4fb6a4976c9 100644 (file)
@@ -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;
        }