From 33ce9783f5e8d748ef9d30546f79e5dfff7ed518 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Wed, 6 Jan 2010 04:08:59 +0000 Subject: [PATCH] (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(). --- includes/LocalisationCache.php | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) 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]; } /** -- 2.20.1