summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorBrion Vibber <brion@status.net>2010-01-06 13:23:39 -0800
committerBrion Vibber <brion@status.net>2010-01-06 13:35:13 -0800
commit85554d0840642f4c1b47b50202dd648db565781c (patch)
tree6433ac0e202ab2416f12c789f99360856e7f9076 /classes
parent6f5b765c97c8616e4a79719bfe835cb03dc0a236 (diff)
Rearrange Memcached_DataObject::staticGet() to avoid "only variables can be passed by reference" warnings when DB lookup fails and we return false.
(We need to keep it returning a reference because the extlib parent class is stuck in PHP 4-land and uses references everywhere, including this function's return value. Yuck!) Also changed pkeyGet to drop the reference, since it doesn't have an upstream equivalent.
Diffstat (limited to 'classes')
-rw-r--r--classes/Memcached_DataObject.php17
1 files changed, 10 insertions, 7 deletions
diff --git a/classes/Memcached_DataObject.php b/classes/Memcached_DataObject.php
index d11bd6368..04f75b775 100644
--- a/classes/Memcached_DataObject.php
+++ b/classes/Memcached_DataObject.php
@@ -90,17 +90,16 @@ class Memcached_DataObject extends DB_DataObject
unset($i);
}
$i = Memcached_DataObject::getcached($cls, $k, $v);
- if ($i !== false) { // false == cache miss
- return $i;
- } else {
+ if ($i === false) { // false == cache miss
$i = DB_DataObject::factory($cls);
if (empty($i)) {
- return false;
+ $i = false;
+ return $i;
}
$result = $i->get($k, $v);
if ($result) {
+ // Hit!
$i->encache();
- return $i;
} else {
// save the fact that no such row exists
$c = self::memcache();
@@ -108,12 +107,16 @@ class Memcached_DataObject extends DB_DataObject
$ck = self::cachekey($cls, $k, $v);
$c->set($ck, null);
}
- return false;
+ $i = false;
}
}
+ return $i;
}
- function &pkeyGet($cls, $kv)
+ /**
+ * @fixme Should this return false on lookup fail to match staticGet?
+ */
+ function pkeyGet($cls, $kv)
{
$i = Memcached_DataObject::multicache($cls, $kv);
if ($i !== false) { // false == cache miss