From be1e1e8d5d726eccd964b404234423bd0119e321 Mon Sep 17 00:00:00 2001 From: icewing Date: Tue, 20 May 2008 16:16:34 +0000 Subject: Marcus Povey * Fixed direct load by guid issue git-svn-id: https://code.elgg.org/elgg/trunk@662 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/objects.php | 7 +++++-- engine/lib/sites.php | 5 ++++- engine/lib/users.php | 7 +++++-- 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/objects.php b/engine/lib/objects.php index 29f29955a..8d78bddd8 100644 --- a/engine/lib/objects.php +++ b/engine/lib/objects.php @@ -70,9 +70,12 @@ throw new InvalidParameterException("Passing a non-ElggObject to an ElggObject constructor!"); // We assume if we have got this far, $guid is an int - else if (is_int($guid)) { + else if (is_numeric($guid)) { if (!$this->load($guid)) throw new IOException("Could not create a new ElggObject object from GUID:$guid"); - } + } + + else + throw new IOException("Unrecognised value passed to constuctor."); } } diff --git a/engine/lib/sites.php b/engine/lib/sites.php index dcaa05b14..cf815d885 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -78,9 +78,12 @@ } // We assume if we have got this far, $guid is an int - else { + else if (is_numeric($guid)) { if (!$this->load($guid)) throw new IOException("Could not create a new ElggSite object from GUID:$guid"); } + + else + throw new IOException("Unrecognised value passed to constuctor."); } } diff --git a/engine/lib/users.php b/engine/lib/users.php index dafd4945a..96881b1df 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -83,9 +83,12 @@ throw new InvalidParameterException("Passing a non-ElggUser to an ElggUser constructor!"); // We assume if we have got this far, $guid is an int - else if (is_int($guid)) { + else if (is_numeric($guid)) { if (!$this->load($guid)) throw new IOException("Could not create a new ElggUser user from GUID:$guid"); - } + } + + else + throw new IOException("Unrecognised value passed to constuctor."); } } -- cgit v1.2.3