Skip to content

Commit d1085fa

Browse files
committed
Add dummy matches arg to preg_match_all() for PHP 5.3 compat.
1 parent 98a4c38 commit d1085fa

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/cli/cli.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,21 +230,21 @@ function strwidth( $string ) {
230230
// Assume UTF-8 - `grapheme_strlen()` will return null if given non-UTF-8 string.
231231
if ( function_exists( 'grapheme_strlen' ) && null !== ( $width = grapheme_strlen( $string ) ) ) {
232232
if ( ! $test_strwidth || ( $test_strwidth & 1 ) ) {
233-
return $width + preg_match_all( $eaw_regex, $string );
233+
return $width + preg_match_all( $eaw_regex, $string, $dummy /*needed for PHP 5.3*/ );
234234
}
235235
}
236236
// Assume UTF-8 - `preg_match_all()` will return false if given non-UTF-8 string (or if PCRE UTF-8 mode is unavailable).
237-
if ( false !== ( $width = preg_match_all( '/\X/u', $string ) ) ) {
237+
if ( false !== ( $width = preg_match_all( '/\X/u', $string, $dummy /*needed for PHP 5.3*/ ) ) ) {
238238
if ( ! $test_strwidth || ( $test_strwidth & 2 ) ) {
239-
return $width + preg_match_all( $eaw_regex, $string );
239+
return $width + preg_match_all( $eaw_regex, $string, $dummy /*needed for PHP 5.3*/ );
240240
}
241241
}
242242
if ( function_exists( 'mb_strwidth' ) && function_exists( 'mb_detect_encoding' ) ) {
243243
$encoding = mb_detect_encoding( $string, null, true /*strict*/ );
244244
$width = mb_strwidth( $string, $encoding );
245245
if ( 'UTF-8' === $encoding ) {
246246
// Subtract combining characters.
247-
$width -= preg_match_all( $m_regex, $string );
247+
$width -= preg_match_all( $m_regex, $string, $dummy /*needed for PHP 5.3*/ );
248248
}
249249
if ( ! $test_strwidth || ( $test_strwidth & 4 ) ) {
250250
return $width;

0 commit comments

Comments
 (0)