Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DV_WikiPage.php |
— | — | @@ -136,6 +136,7 @@ |
137 | 137 | |
138 | 138 | public function getShortHTMLText($linker = NULL) { |
139 | 139 | $this->unstub(); |
| 140 | + if ( ($linker !== NULL) && ($this->m_caption !== '') ) { $this->getTitle(); } // init the Title object, may reveal hitherto unnoticed errors |
140 | 141 | if ( ($linker === NULL) || (!$this->isValid()) || ($this->m_caption === '') ) { |
141 | 142 | return htmlspecialchars($this->getCaption()); |
142 | 143 | } else { |
— | — | @@ -168,6 +169,7 @@ |
169 | 170 | |
170 | 171 | public function getLongHTMLText($linker = NULL) { |
171 | 172 | $this->unstub(); |
| 173 | + if ($linker !== NULL) { $this->getTitle(); } // init the Title object, may reveal hitherto unnoticed errors |
172 | 174 | if (!$this->isValid()) { |
173 | 175 | return $this->getErrorText(); |
174 | 176 | } |
— | — | @@ -245,10 +247,15 @@ |
246 | 248 | |
247 | 249 | /** |
248 | 250 | * Return according Title object or NULL if no valid value was set. |
| 251 | + * NULL can be returned even if this object returns TRUE for isValue(), |
| 252 | + * since the latter function does not check whether MediaWiki can really |
| 253 | + * make a Title out of the given data. |
| 254 | + * However, isValid() will return FALSE *after* this function failed in |
| 255 | + * trying to create a title. |
249 | 256 | */ |
250 | 257 | public function getTitle() { |
251 | 258 | $this->unstub(); |
252 | | - if ($this->m_title === NULL) { |
| 259 | + if ( ($this->isValid()) && ($this->m_title === NULL) ) { |
253 | 260 | if ($this->m_interwiki == '') { |
254 | 261 | $this->m_title = Title::makeTitle($this->m_namespace, $this->m_dbkeyform); |
255 | 262 | } else { // interwiki title objects must be built from full input texts |