From 3d03ea697f18d6e779ac88024f5e6a12bff6788f Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 15 May 2012 10:50:21 -0700 Subject: Follow-on to ce34e89c899a3fca6d647e99742c39b8b7a4f3e0 for #1865 - allow strings and coerce them to integers. It might be easier to just cast whatever comes in, but I'm worried that we'll accidentally cast an array to an int(1) without realizing it. --- modules/gallery/libraries/MY_ORM.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/gallery/libraries/MY_ORM.php b/modules/gallery/libraries/MY_ORM.php index ac61e75b..4194162b 100644 --- a/modules/gallery/libraries/MY_ORM.php +++ b/modules/gallery/libraries/MY_ORM.php @@ -23,10 +23,10 @@ class ORM extends ORM_Core { * Make sure that we're only using integer ids. */ static function factory($model, $id=null) { - if ($id && !is_int($id)) { + if ($id && !is_int($id) && !is_string($id)) { throw new Exception("@todo ORM::factory requires integer ids"); } - return ORM_Core::factory($model, $id); + return ORM_Core::factory($model, (int) $id); } public function save() { -- cgit v1.2.3