jenkins-bot has submitted this change and it was merged.

Change subject: Title: Throw if newFromText is given an invalid value
......................................................................


Title: Throw if newFromText is given an invalid value

Follows-up 448c7ea03a, 372ded2f, 156bcbec, Ic85d27d.

* Removes the logger added in 448c7ea03a.
* Turn the warning into an exception. This was difficult previously
  because non-string values were common. However most of them were
  all null. Cases of other primitives (type object already throws)
  have been fixed.

Bug: T76305
Change-Id: I62fe3f700d94168ca35c833410171b1c48e6c4f3
---
M includes/Title.php
1 file changed, 1 insertion(+), 5 deletions(-)

Approvals:
  Krinkle: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/Title.php b/includes/Title.php
index f4a6894..95588a2 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -268,13 +268,9 @@
         * @return Title|null Title or null on an error.
         */
        public static function newFromText( $text, $defaultNamespace = NS_MAIN 
) {
-               if ( is_object( $text ) ) {
-                       throw new InvalidArgumentException( '$text must be a 
string.' );
-               }
                // DWIM: Integers can be passed in here when page titles are 
used as array keys.
                if ( $text !== null && !is_string( $text ) && !is_int( $text ) 
) {
-                       wfDebugLog( 'T76305', wfGetAllCallers( 5 ) );
-                       return null;
+                       throw new InvalidArgumentException( '$text must be a 
string.' );
                }
                if ( $text === null ) {
                        return null;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I62fe3f700d94168ca35c833410171b1c48e6c4f3
Gerrit-PatchSet: 9
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: Alex Monk <kren...@gmail.com>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Nemo bis <federicol...@tiscali.it>
Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to