r60711 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60710‎ | r60711 | r60712 >
Date:04:08, 6 January 2010
Author:tstarling
Status:deferred
Tags:
Comment:
(bug 20837) Don't give a PHP notice when getSubitem() calls loadSubitem() which causes the whole item to be loaded. In this case there is no negative cache value stored so we need to use isset(). It was handled already for the case where the item was already loaded at function entry, but not for the case where the item is loaded halfway through loadSubitem().
Modified paths:
  • /trunk/phase3/includes/LocalisationCache.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LocalisationCache.php
@@ -218,20 +218,18 @@
219219 if ( isset( $this->legacyData[$code][$key][$subkey] ) ) {
220220 return $this->legacyData[$code][$key][$subkey];
221221 }
222 - if ( !isset( $this->loadedSubitems[$code][$key][$subkey] ) ) {
223 - if ( isset( $this->loadedItems[$code][$key] ) ) {
224 - if ( isset( $this->data[$code][$key][$subkey] ) ) {
225 - return $this->data[$code][$key][$subkey];
226 - } else {
227 - return null;
228 - }
229 - } else {
230 - wfProfileIn( __METHOD__.'-load' );
231 - $this->loadSubitem( $code, $key, $subkey );
232 - wfProfileOut( __METHOD__.'-load' );
233 - }
 222+ if ( !isset( $this->loadedSubitems[$code][$key][$subkey] )
 223+ && !isset( $this->loadedItems[$code][$key] ) )
 224+ {
 225+ wfProfileIn( __METHOD__.'-load' );
 226+ $this->loadSubitem( $code, $key, $subkey );
 227+ wfProfileOut( __METHOD__.'-load' );
234228 }
235 - return $this->data[$code][$key][$subkey];
 229+ if ( isset( $this->data[$code][$key][$subkey] ) ) {
 230+ return $this->data[$code][$key][$subkey];
 231+ } else {
 232+ return null;
 233+ }
236234 }
237235
238236 /**

Status & tagging log