Make WordPress Core

Changeset 55652


Ignore:
Timestamp:
04/15/2023 12:09:08 PM (19 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison where strlen() is involved.

Follow-up to [649], [1345], [3034], [6132], [6314], [6974], [55642].

Props aristath, poena, afercia, SergeyBiryukov.
See #57839.

Location:
trunk/src/wp-includes
Files:
4 edited

Legend:

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

    r55651 r55652  
    899899        }
    900900        for ( $j = 0; $j < $n; $j++ ) { // n bytes matching 10bbbbbb follow ?
    901             if ( ( ++$i == $length ) || ( ( ord( $str[ $i ] ) & 0xC0 ) != 0x80 ) ) {
     901            if ( ( ++$i === $length ) || ( ( ord( $str[ $i ] ) & 0xC0 ) != 0x80 ) ) {
    902902                return false;
    903903            }
     
    51395139    while ( $len > $start ) {
    51405140        // Last character: append and break.
    5141         if ( strlen( $pattern ) - 1 == $start ) {
     5141        if ( strlen( $pattern ) - 1 === $start ) {
    51425142            $result .= substr( $pattern, -1 );
    51435143            break;
  • trunk/src/wp-includes/kses.php

    r55642 r55652  
    13311331    // Loop through the whole attribute list.
    13321332
    1333     while ( strlen( $attr ) != 0 ) {
     1333    while ( strlen( $attr ) !== 0 ) {
    13341334        $working = 0; // Was the last operation successful?
    13351335
  • trunk/src/wp-includes/load.php

    r55537 r55652  
    4141
    4242    // Fix for IIS when running with PHP ISAPI.
    43     if ( empty( $_SERVER['REQUEST_URI'] ) || ( 'cgi-fcgi' !== PHP_SAPI && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
     43    if ( empty( $_SERVER['REQUEST_URI'] )
     44        || ( 'cgi-fcgi' !== PHP_SAPI && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) )
     45    ) {
    4446
    4547        if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) {
     
    7274
    7375    // Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests.
    74     if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) ) {
     76    if ( isset( $_SERVER['SCRIPT_FILENAME'] )
     77        && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) === strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 )
     78    ) {
    7579        $_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
    7680    }
  • trunk/src/wp-includes/post-template.php

    r55262 r55652  
    4343    $title = get_the_title();
    4444
    45     if ( strlen( $title ) == 0 ) {
     45    if ( strlen( $title ) === 0 ) {
    4646        return;
    4747    }
     
    8989    $title = get_the_title( $parsed_args['post'] );
    9090
    91     if ( strlen( $title ) == 0 ) {
     91    if ( strlen( $title ) === 0 ) {
    9292        return;
    9393    }
Note: See TracChangeset for help on using the changeset viewer.