// parse_url("%0Ahttp://example.com") == array( 'host' => '%0Ahttp', 'path' => 'example.com' )
if ( !$bits ||
!isset( $bits['scheme'] ) && strpos( $url, "://" ) !== false ) {
- wfWarn( __METHOD__ . ": Invalid URL: $url" );
+ wfDebug( __METHOD__ . ": Invalid URL: $url" );
return false;
} else {
$scheme = isset( $bits['scheme'] ) ? $bits['scheme'] : null;
if ( in_array( $scheme . '://', $wgUrlProtocols ) ) {
$bits['delimiter'] = '://';
} elseif ( !is_null( $scheme ) && !in_array( $scheme . ':', $wgUrlProtocols ) ) {
- wfWarn( __METHOD__ . ": Invalid scheme in URL: $scheme" );
+ wfDebug( __METHOD__ . ": Invalid scheme in URL: $scheme" );
return false;
} elseif( !is_null( $scheme ) ) {
if( !in_array( $scheme . ':', $wgUrlProtocols ) ) {
} elseif ( $uri instanceof Uri ) {
$this->setComponents( $uri->getComponents() );
} else {
- throw new MWException( __METHOD__ . ': $uri is not of a valid type.' );
+ throw new MWException( __METHOD__ . ": $uri is not of a valid type." );
}
}
foreach ( $components as $name => $value ) {
if ( isset( self::$componentAliases[$name] ) ) {
$canonical = self::$componentAliases[$name];
- wfWarn( __METHOD__ . ": Converting alias $name to canonical $canonical." );
+ wfDebug( __METHOD__ . ": Converting alias $name to canonical $canonical." );
$components[$canonical] = $value;
unset( $components[$name] );
} elseif ( !in_array( $name, self::$validComponents ) ) {
- wfWarn( __METHOD__ . ": $name is not a valid component." );
- unset( $components[$name] );
+ throw new MWException( __METHOD__ . ": $name is not a valid component." );
}
}
// Component is an alias. Get the actual name.
$alias = $name;
$name = self::$componentAliases[$name];
- wfWarn( __METHOD__ . ": Converting alias $alias to canonical $name." );
+ wfDebug( __METHOD__ . ": Converting alias $alias to canonical $name." );
}
if( !in_array( $name, self::$validComponents ) ) {
if ( isset( self::$componentAliases[$name] ) ) {
$alias = $name;
$name = self::$componentAliases[$name];
- wfWarn( __METHOD__ . ": Converting alias $alias to canonical $name." );
+ wfDebug( __METHOD__ . ": Converting alias $alias to canonical $name." );
} elseif ( !in_array( $name, self::$validComponents ) ) {
throw new MWException( __METHOD__ . ": $name is not a valid component." );
}
* @return Uri this URI object
*/
public function extendQuery( $parameters ) {
- if ( is_string( $parameters ) ) {
+ if ( !is_array( $parameters ) ) {
$parameters = wfCgiToArray( $parameters );
}