Add second param to Title::newFromText warning so that called from works correctly
[lhc/web/wiklou.git] / includes / Title.php
index 9868b2e..86e9746 100644 (file)
@@ -260,8 +260,10 @@ class Title {
         * @return Title|null Title or null on an error.
         */
        public static function newFromText( $text, $defaultNamespace = NS_MAIN ) {
-               if ( !is_string( $text ) ) {
-                       throw new InvalidArgumentException( 'Title::newFromText given something that isn\'t a string' );
+               if ( is_object( $text ) ) {
+                       throw new InvalidArgumentException( '$text must be a string.' );
+               } elseif ( !is_string( $text ) ) {
+                       wfWarn( __METHOD__ . ': $text must be a string. This will throw an InvalidArgumentException in future.', 2 );
                }
 
                $cache = self::getTitleCache();