Make WordPress Core


Ignore:
Timestamp:
04/24/2020 07:26:57 AM (21 months 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/canonical.php

    r47550 r47617  
    6868    }
    6969
    70     $original = @parse_url( $requested_url );
     70    $original = parse_url( $requested_url );
    7171    if ( false === $original ) {
    7272        return;
     
    408408    if ( $redirect_url && ! empty( $redirect['query'] ) ) {
    409409        parse_str( $redirect['query'], $_parsed_query );
    410         $redirect = @parse_url( $redirect_url );
     410        $redirect = parse_url( $redirect_url );
    411411
    412412        if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) {
     
    426426
    427427    if ( $redirect_url ) {
    428         $redirect = @parse_url( $redirect_url );
     428        $redirect = parse_url( $redirect_url );
    429429    }
    430430
    431431    // www.example.com vs. example.com
    432     $user_home = @parse_url( home_url() );
     432    $user_home = parse_url( home_url() );
    433433    if ( ! empty( $user_home['host'] ) ) {
    434434        $redirect['host'] = $user_home['host'];
     
    638638 */
    639639function _remove_qs_args_if_not_in_url( $query_string, array $args_to_check, $url ) {
    640     $parsed_url = @parse_url( $url );
     640    $parsed_url = parse_url( $url );
    641641    if ( ! empty( $parsed_url['query'] ) ) {
    642642        parse_str( $parsed_url['query'], $parsed_query );
     
    661661 */
    662662function strip_fragment_from_url( $url ) {
    663     $parsed_url = @parse_url( $url );
     663    $parsed_url = parse_url( $url );
    664664    if ( ! empty( $parsed_url['host'] ) ) {
    665665        // This mirrors code in redirect_canonical(). It does not handle every case.
Note: See TracChangeset for help on using the changeset viewer.