Make WordPress Core


Ignore:
Timestamp:
04/24/2020 07:26:57 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Remove error suppression from parse_url() calls.

Previously, the @ operator was used to prevent possible warnings emitted by parse_url() in PHP < 5.3.3 when URL parsing failed.

Now that the minimum version of PHP required by WordPress is 5.6.20, this is no longer needed.

Props netpassprodsr, Howdy_McGee.
Fixes #49980. See #24780.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/http.php

    r47550 r47617  
    523523    }
    524524
    525     $parsed_url = @parse_url( $url );
     525    $parsed_url = parse_url( $url );
    526526    if ( ! $parsed_url || empty( $parsed_url['host'] ) ) {
    527527        return false;
     
    536536    }
    537537
    538     $parsed_home = @parse_url( get_option( 'home' ) );
     538    $parsed_home = parse_url( get_option( 'home' ) );
    539539
    540540    if ( isset( $parsed_home['host'] ) ) {
     
    655655 * differences as well.
    656656 *
    657  * Error suppression is used as prior to PHP 5.3.3, an E_WARNING would be generated
    658  * when URL parsing failed.
    659  *
    660657 * @since 4.4.0
    661658 * @since 4.7.0 The `$component` parameter was added for parity with PHP's `parse_url()`.
     
    685682    }
    686683
    687     $parts = @parse_url( $url );
     684    $parts = parse_url( $url );
    688685
    689686    if ( false === $parts ) {
Note: See TracChangeset for help on using the changeset viewer.