mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@55652 git-svn-id: http://core.svn.wordpress.org/trunk@55164 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f0352db3e4
commit
4d6f46401f
@ -898,7 +898,7 @@ function seems_utf8( $str ) {
|
||||
return false; // Does not match any model.
|
||||
}
|
||||
for ( $j = 0; $j < $n; $j++ ) { // n bytes matching 10bbbbbb follow ?
|
||||
if ( ( ++$i == $length ) || ( ( ord( $str[ $i ] ) & 0xC0 ) != 0x80 ) ) {
|
||||
if ( ( ++$i === $length ) || ( ( ord( $str[ $i ] ) & 0xC0 ) != 0x80 ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -5138,7 +5138,7 @@ function wp_sprintf( $pattern, ...$args ) {
|
||||
$arg_index = 0;
|
||||
while ( $len > $start ) {
|
||||
// Last character: append and break.
|
||||
if ( strlen( $pattern ) - 1 == $start ) {
|
||||
if ( strlen( $pattern ) - 1 === $start ) {
|
||||
$result .= substr( $pattern, -1 );
|
||||
break;
|
||||
}
|
||||
|
@ -1330,7 +1330,7 @@ function wp_kses_hair( $attr, $allowed_protocols ) {
|
||||
|
||||
// Loop through the whole attribute list.
|
||||
|
||||
while ( strlen( $attr ) != 0 ) {
|
||||
while ( strlen( $attr ) !== 0 ) {
|
||||
$working = 0; // Was the last operation successful?
|
||||
|
||||
switch ( $mode ) {
|
||||
|
@ -40,7 +40,9 @@ function wp_fix_server_vars() {
|
||||
$_SERVER = array_merge( $default_server_values, $_SERVER );
|
||||
|
||||
// Fix for IIS when running with PHP ISAPI.
|
||||
if ( empty( $_SERVER['REQUEST_URI'] ) || ( 'cgi-fcgi' !== PHP_SAPI && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) ) ) {
|
||||
if ( empty( $_SERVER['REQUEST_URI'] )
|
||||
|| ( 'cgi-fcgi' !== PHP_SAPI && preg_match( '/^Microsoft-IIS\//', $_SERVER['SERVER_SOFTWARE'] ) )
|
||||
) {
|
||||
|
||||
if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) {
|
||||
// IIS Mod-Rewrite.
|
||||
@ -71,7 +73,9 @@ function wp_fix_server_vars() {
|
||||
}
|
||||
|
||||
// Fix for PHP as CGI hosts that set SCRIPT_FILENAME to something ending in php.cgi for all requests.
|
||||
if ( isset( $_SERVER['SCRIPT_FILENAME'] ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) == strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 ) ) {
|
||||
if ( isset( $_SERVER['SCRIPT_FILENAME'] )
|
||||
&& ( strpos( $_SERVER['SCRIPT_FILENAME'], 'php.cgi' ) === strlen( $_SERVER['SCRIPT_FILENAME'] ) - 7 )
|
||||
) {
|
||||
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['PATH_TRANSLATED'];
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ function get_the_ID() { // phpcs:ignore WordPress.NamingConventions.ValidFunctio
|
||||
function the_title( $before = '', $after = '', $display = true ) {
|
||||
$title = get_the_title();
|
||||
|
||||
if ( strlen( $title ) == 0 ) {
|
||||
if ( strlen( $title ) === 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ function the_title_attribute( $args = '' ) {
|
||||
|
||||
$title = get_the_title( $parsed_args['post'] );
|
||||
|
||||
if ( strlen( $title ) == 0 ) {
|
||||
if ( strlen( $title ) === 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.3-alpha-55651';
|
||||
$wp_version = '6.3-alpha-55652';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user