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/comment.php

    r47611 r47617  
    581581     */
    582582    $comment_cookie_lifetime = time() + apply_filters( 'comment_cookie_lifetime', 30000000 );
    583     $secure                  = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
     583
     584    $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
     585
    584586    setcookie( 'comment_author_' . COOKIEHASH, $comment->comment_author, $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
    585587    setcookie( 'comment_author_email_' . COOKIEHASH, $comment->comment_author_email, $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
     
    28532855        // If we haven't pung it already and it isn't a link to itself.
    28542856        if ( ! in_array( $link_test, $pung, true ) && ( url_to_postid( $link_test ) != $post->ID )
    2855                 // Also, let's never ping local attachments.
    2856                 && ! is_local_attachment( $link_test ) ) {
    2857             $test = @parse_url( $link_test );
     2857            // Also, let's never ping local attachments.
     2858            && ! is_local_attachment( $link_test )
     2859        ) {
     2860            $test = parse_url( $link_test );
    28582861            if ( $test ) {
    28592862                if ( isset( $test['query'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.