From 9e04750fc495a93c1272ca99410af7cdf2079add Mon Sep 17 00:00:00 2001 From: Drew Jaynes Date: Sat, 19 Dec 2015 04:50:28 +0000 Subject: [PATCH] Docs: Fix inline comment syntax in `_mb_substr()`, an internal compat method for `mb_substr()`. See #32246. Built from https://develop.svn.wordpress.org/trunk@36018 git-svn-id: http://core.svn.wordpress.org/trunk@35983 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/compat.php | 20 ++++++++++++++------ wp-includes/version.php | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/wp-includes/compat.php b/wp-includes/compat.php index 69a5a7ce6c..c097ca307a 100644 --- a/wp-includes/compat.php +++ b/wp-includes/compat.php @@ -82,14 +82,16 @@ function _mb_substr( $str, $start, $length = null, $encoding = null ) { $encoding = get_option( 'blog_charset' ); } - // The solution below works only for UTF-8, - // so in case of a different charset just use built-in substr() + /* + * The solution below works only for UTF-8, so in case of a different + * charset just use built-in substr(). + */ if ( ! in_array( $encoding, array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) { return is_null( $length ) ? substr( $str, $start ) : substr( $str, $start, $length ); } if ( _wp_can_use_pcre_u() ) { - // Use the regex unicode support to separate the UTF-8 characters into an array + // Use the regex unicode support to separate the UTF-8 characters into an array. preg_match_all( '/./us', $str, $match ); $chars = is_null( $length ) ? array_slice( $match[0], $start ) : array_slice( $match[0], $start, $length ); return implode( '', $chars ); @@ -107,16 +109,22 @@ function _mb_substr( $str, $start, $length = null, $encoding = null ) { | \xF4[\x80-\x8F][\x80-\xBF]{2} )/x'; - $chars = array( '' ); // Start with 1 element instead of 0 since the first thing we do is pop + // Start with 1 element instead of 0 since the first thing we do is pop. + $chars = array( '' ); do { // We had some string left over from the last round, but we counted it in that last round. array_pop( $chars ); - // Split by UTF-8 character, limit to 1000 characters (last array element will contain the rest of the string) + /* + * Split by UTF-8 character, limit to 1000 characters (last array element will contain + * the rest of the string). + */ $pieces = preg_split( $regex, $str, 1000, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ); $chars = array_merge( $chars, $pieces ); - } while ( count( $pieces ) > 1 && $str = array_pop( $pieces ) ); // If there's anything left over, repeat the loop. + + // If there's anything left over, repeat the loop. + } while ( count( $pieces ) > 1 && $str = array_pop( $pieces ) ); return join( '', array_slice( $chars, $start, $length ) ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index f6b3491751..3d7eff17b4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-36017'; +$wp_version = '4.5-alpha-36018'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.