From: Tim Starling Date: Wed, 6 Jan 2010 04:08:59 +0000 (+0000) Subject: (bug 20837) Don't give a PHP notice when getSubitem() calls loadSubitem() which cause... X-Git-Tag: 1.31.0-rc.0~38397 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/Category:Foo?a=commitdiff_plain;h=33ce9783f5e8d748ef9d30546f79e5dfff7ed518;p=lhc%2Fweb%2Fwiklou.git (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(). --- diff --git a/includes/LocalisationCache.php b/includes/LocalisationCache.php index 6ff286f9d8..efe5ab8762 100644 --- a/includes/LocalisationCache.php +++ b/includes/LocalisationCache.php @@ -218,20 +218,18 @@ class LocalisationCache { if ( isset( $this->legacyData[$code][$key][$subkey] ) ) { return $this->legacyData[$code][$key][$subkey]; } - if ( !isset( $this->loadedSubitems[$code][$key][$subkey] ) ) { - if ( isset( $this->loadedItems[$code][$key] ) ) { - if ( isset( $this->data[$code][$key][$subkey] ) ) { - return $this->data[$code][$key][$subkey]; - } else { - return null; - } - } else { - wfProfileIn( __METHOD__.'-load' ); - $this->loadSubitem( $code, $key, $subkey ); - wfProfileOut( __METHOD__.'-load' ); - } + if ( !isset( $this->loadedSubitems[$code][$key][$subkey] ) + && !isset( $this->loadedItems[$code][$key] ) ) + { + wfProfileIn( __METHOD__.'-load' ); + $this->loadSubitem( $code, $key, $subkey ); + wfProfileOut( __METHOD__.'-load' ); + } + if ( isset( $this->data[$code][$key][$subkey] ) ) { + return $this->data[$code][$key][$subkey]; + } else { + return null; } - return $this->data[$code][$key][$subkey]; } /**