r93697 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93696‎ | r93697 | r93698 >
Date:00:27, 2 August 2011
Author:aaron
Status:ok (Comments)
Tags:
Comment:
Ported r93695 to /trunk
Modified paths:
  • /trunk/extensions/MobileFrontend/library/WURFL/Storage/Mwmemcache.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/library/WURFL/Storage/Mwmemcache.php
@@ -33,7 +33,7 @@
3434 return $wgMemc->set( $this->encode( $this->namespace, $objectId ), $object, $this->expiration );
3535 }
3636
37 -
 37+
3838 /**
3939 * Load the object.
4040 *
@@ -44,7 +44,7 @@
4545 public function load($objectId) {
4646 global $wgMemc;
4747 $value = $wgMemc->get( $this->encode( $this->namespace, $objectId ) );
48 - return $value;
 48+ return $value ? $value : null; // WURFL expects null on cache miss
4949 }
5050
5151

Follow-up revisions

RevisionCommit summaryAuthorDate
r93767Do r93697 change properly, to avoid loose-typing problems if this ends up get...aaron16:33, 2 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93695Made load() return null on miss, since CustomDeviceRepository breaks otherwiseaaron00:22, 2 August 2011

Comments

#Comment by Reedy (talk | contribs)   14:15, 2 August 2011

"Also, instead of using "return $value ? $value : null;" you should use "return ($value !== false)? $value : null;", otherwise you cannot return anything that evaluates loosely as false, like "0"."

#Comment by Aaron Schulz (talk | contribs)   16:26, 2 August 2011

Not urgent (its used for Objects), but that's a good idea. I was fixing this in a bit of haste.

Status & tagging log