Nikerabbit has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/188987

Change subject: Check for string in Title::newFromText
......................................................................

Check for string in Title::newFromText

To stop wasting my time hiding the problem behind weird
stack traces and errors:

2) SpecialPagesTest::testSpecialPage with data set #12 ('TranslationStash')
array_key_exists(): The first argument should be either a string or an integer

/www/dev.translatewiki.net/docroot/w/includes/libs/MapCacheLRU.php:77
/www/dev.translatewiki.net/docroot/w/includes/Title.php:279
/www/dev.translatewiki.net/docroot/w/extensions/Translate/specials/SpecialTranslationStash.php:31
/www/dev.translatewiki.net/docroot/w/includes/specialpage/SpecialPage.php:383
/www/dev.translatewiki.net/docroot/w/extensions/Translate/tests/phpunit/SpecialPagesTest.php:54
/www/dev.translatewiki.net/docroot/w/tests/phpunit/MediaWikiTestCase.php:141

Warning: this commit is likely to expose issues where bools/numbers are
being passed here.

Change-Id: I62fe3f700d94168ca35c833410171b1c48e6c4f3
---
M includes/Title.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/87/188987/1

diff --git a/includes/Title.php b/includes/Title.php
index 9a7cd04..4375df4 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -262,8 +262,8 @@
         * @return Title|null Title or null on an error.
         */
        public static function newFromText( $text, $defaultNamespace = NS_MAIN 
) {
-               if ( is_object( $text ) ) {
-                       throw new MWException( 'Title::newFromText given an 
object' );
+               if ( !is_string( $text ) ) {
+                       throw new MWException( 'Title::newFromText not given a 
string' );
                }
 
                $cache = self::getTitleCache();

-- 
To view, visit https://gerrit.wikimedia.org/r/188987
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I62fe3f700d94168ca35c833410171b1c48e6c4f3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <[email protected]>

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

Reply via email to