User "Catrope" posted a comment on MediaWiki.r96824.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96824#c22581
Commit summary:

SpecialSearch: add two hooks, one to modify the power search box, one to change 
the message pointing to the page title searched for

WikimediaIncubator:
* use these hooks and SpecialSearchSetupEngine to improve search usability
* use a different message for the language code in preferences, per suggestion 
of Amir

Comment:

The function start with:

<pre>
        protected function showCreateLink( $t ) {
                // show direct page/create link if applicable
                // Check DBkey !== '' in case of fragment link only.
                $messageName = null;
                if( !is_null($t) && $t->getDBkey() !== '' ) {
                        if( $t->isKnown() ) {
                                $messageName = 'searchmenu-exists';
                        } elseif( $t->userCan( 'create' ) ) {
                                $messageName = 'searchmenu-new';
                        } else {
                                $messageName = 'searchmenu-new-nocreate';
                        }
                }
</pre>
and below that you are adding (outside of the if block!):
<pre>
+               $params = array( $messageName, wfEscapeWikiText( 
$t->getPrefixedText() ) );
+               wfRunHooks( 'SpecialSearchCreateLink', array( $t, &$params ) );
</pre>

So you're calling <code>$t->getPrefixedText()</code> unconditionally, right 
after the end of an if statement that checks that $t isn't null before messing 
with it.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to