Mostly revert "Verify parameter for MapCacheLRU::has() can be passed to array_key_exi...
authorAlex Monk <krenair@gmail.com>
Tue, 7 Apr 2015 01:41:33 +0000 (01:41 +0000)
committerKrinkle <krinklemail@gmail.com>
Tue, 7 Apr 2015 02:08:11 +0000 (02:08 +0000)
This broke a few things, and the debug line was basically pointless.

Instead, continue to only throw an exception if $text is an object, but only
warn if it's otherwise not a string.

This reverts commit 372ded2fea436bf0e61318991f903d61bde26366.

Change-Id: I060da9191cdbd00c4873caba875bfb77c917bcd7

includes/Title.php
includes/libs/MapCacheLRU.php

index 9868b2e..bf0fb8e 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.' );
                }
 
                $cache = self::getTitleCache();
index b0cb078..0b6db32 100644 (file)
@@ -74,11 +74,7 @@ class MapCacheLRU {
         * @return bool
         */
        public function has( $key ) {
-               if ( is_string( $key ) || is_integer( $key ) ) {
-                       return array_key_exists( $key, $this->cache );
-               }
-               wfWarn( __METHOD__ . ": Key passed isn't a string or an integer.", 2 );
-               return false;
+               return array_key_exists( $key, $this->cache );
        }
 
        /**