Index: trunk/phase3/includes/StubObject.php |
— | — | @@ -88,6 +88,10 @@ |
89 | 89 | */ |
90 | 90 | function _unstub( $name = '_unstub', $level = 2 ) { |
91 | 91 | static $recursionLevel = 0; |
| 92 | + |
| 93 | + if ( !($GLOBALS[$this->mGlobal] instanceof StubObject) ) |
| 94 | + return $GLOBALS[$this->mGlobal]; // already unstubbed. |
| 95 | + |
92 | 96 | if ( get_class( $GLOBALS[$this->mGlobal] ) != $this->mClass ) { |
93 | 97 | $fname = __METHOD__.'-'.$this->mGlobal; |
94 | 98 | wfProfileIn( $fname ); |
— | — | @@ -96,7 +100,7 @@ |
97 | 101 | throw new MWException( "Unstub loop detected on call of \${$this->mGlobal}->$name from $caller\n" ); |
98 | 102 | } |
99 | 103 | wfDebug( "Unstubbing \${$this->mGlobal} on call of \${$this->mGlobal}::$name from $caller\n" ); |
100 | | - $GLOBALS[$this->mGlobal] = $this->_newObject(); |
| 104 | + $obj = $GLOBALS[$this->mGlobal] = $this->_newObject(); |
101 | 105 | --$recursionLevel; |
102 | 106 | wfProfileOut( $fname ); |
103 | 107 | } |