Suppress warnings around parse_url call
authorReedy <reedy@wikimedia.org>
Sat, 28 Jul 2012 18:50:34 +0000 (19:50 +0100)
committerReedy <reedy@wikimedia.org>
Sat, 28 Jul 2012 18:50:34 +0000 (19:50 +0100)
From the docs:
On seriously malformed URLs, parse_url may return false and emit a E_WARNING

We're already checking for false, but we can get spammed with E_WARNING..

Change-Id: I44a9ef2b163e64113bd2a30b081c1256ffeada1e

includes/WebRequest.php

index 766db46..91bd923 100644 (file)
@@ -88,7 +88,9 @@ class WebRequest {
                        if ( !preg_match( '!^https?://!', $url ) ) {
                                $url = 'http://unused' . $url;
                        }
+                       wfSuppressWarnings();
                        $a = parse_url( $url );
+                       wfRestoreWarnings();
                        if( $a ) {
                                $path = isset( $a['path'] ) ? $a['path'] : '';