mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-29 07:37:44 +02: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.
|
return false; // Does not match any model.
|
||||||
}
|
}
|
||||||
for ( $j = 0; $j < $n; $j++ ) { // n bytes matching 10bbbbbb follow ?
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5138,7 +5138,7 @@ function wp_sprintf( $pattern, ...$args ) {
|
|||||||
$arg_index = 0;
|
$arg_index = 0;
|
||||||
while ( $len > $start ) {
|
while ( $len > $start ) {
|
||||||
// Last character: append and break.
|
// Last character: append and break.
|
||||||
if ( strlen( $pattern ) - 1 == $start ) {
|
if ( strlen( $pattern ) - 1 === $start ) {
|
||||||
$result .= substr( $pattern, -1 );
|
$result .= substr( $pattern, -1 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1330,7 +1330,7 @@ function wp_kses_hair( $attr, $allowed_protocols ) {
|
|||||||
|
|
||||||
// Loop through the whole attribute list.
|
// Loop through the whole attribute list.
|
||||||
|
|
||||||
while ( strlen( $attr ) != 0 ) {
|
while ( strlen( $attr ) !== 0 ) {
|
||||||
$working = 0; // Was the last operation successful?
|
$working = 0; // Was the last operation successful?
|
||||||
|
|
||||||
switch ( $mode ) {
|
switch ( $mode ) {
|
||||||
|
@ -40,7 +40,9 @@ function wp_fix_server_vars() {
|
|||||||
$_SERVER = array_merge( $default_server_values, $_SERVER );
|
$_SERVER = array_merge( $default_server_values, $_SERVER );
|
||||||
|
|
||||||
// Fix for IIS when running with PHP ISAPI.
|
// 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'] ) ) {
|
if ( isset( $_SERVER['HTTP_X_ORIGINAL_URL'] ) ) {
|
||||||
// IIS Mod-Rewrite.
|
// 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.
|
// 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'];
|
$_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 ) {
|
function the_title( $before = '', $after = '', $display = true ) {
|
||||||
$title = get_the_title();
|
$title = get_the_title();
|
||||||
|
|
||||||
if ( strlen( $title ) == 0 ) {
|
if ( strlen( $title ) === 0 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ function the_title_attribute( $args = '' ) {
|
|||||||
|
|
||||||
$title = get_the_title( $parsed_args['post'] );
|
$title = get_the_title( $parsed_args['post'] );
|
||||||
|
|
||||||
if ( strlen( $title ) == 0 ) {
|
if ( strlen( $title ) === 0 ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @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.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user