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
* @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();
* @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 );
}
/**