From: Timo Tijhof Date: Wed, 4 Nov 2015 01:20:51 +0000 (+0000) Subject: Title: Throw if newFromText is given an invalid value X-Git-Tag: 1.31.0-rc.0~7280^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=2e5047646f3e2387c3d6d3a8517983d6f4aac627;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/Title.php b/includes/Title.php index f4a6894a40..95588a222a 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -268,13 +268,9 @@ class Title implements LinkTarget { * @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;