summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2012-05-15 10:50:21 -0700
committerBharat Mediratta <bharat@menalto.com>2012-05-15 10:50:21 -0700
commit3d03ea697f18d6e779ac88024f5e6a12bff6788f (patch)
tree59b6e434cbba4a8e133e1c4b1a3f3de88bd03794 /modules
parentebc55f208e6966496044ea097cab0121d1841539 (diff)
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.
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/libraries/MY_ORM.php4
1 files changed, 2 insertions, 2 deletions
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() {