Make WordPress Core

Changeset 60726


Ignore:
Timestamp:
09/10/2025 03:15:39 AM (3 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Simplify a conditional in get_url_in_content().

As there's an is_string() check already, ! empty( $href ) can be simplified to a string comparison, as the other variable types that are checked in empty() won't appear.

empty() also returns false for the string "0" which would however be a valid (relative) URL and thus should be detectable by the function.

Follow-up to [60665].

Props TobiasBg.
Fixes #63694.

File:
1 edited

Legend:

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

    r60714 r60726  
    59905990    while ( $processor->next_tag( 'A' ) ) {
    59915991        $href = $processor->get_attribute( 'href' );
    5992         if ( is_string( $href ) && ! empty( $href ) ) {
     5992        if ( is_string( $href ) && '' !== $href ) {
    59935993            return sanitize_url( $href );
    59945994        }
Note: See TracChangeset for help on using the changeset viewer.