From cfaaff106862e84bb15e4bc21acd43843715cb2f Mon Sep 17 00:00:00 2001 From: Kevin Israel Date: Wed, 13 May 2015 03:36:43 -0400 Subject: [PATCH] wfBaseConvert(): Avoid PHP warning when converting zero The warning occurs when gmp_init() tries to convert the empty string that came from ltrim(). This is causing tests to fail under HHVM 3.6.1. Follows-up 5957856c46c3. Bug: T98882 Change-Id: Ica86c91d7897db979e09d7cfc82fb3a20b95d4ce --- includes/GlobalFunctions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 6eaeb25afd..8b3b959a36 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -3353,7 +3353,7 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad = 1, // Removing leading zeros works around broken base detection code in // some PHP versions (see and // ). - $result = gmp_strval( gmp_init( ltrim( $input, '0' ), $sourceBase ), $destBase ); + $result = gmp_strval( gmp_init( ltrim( $input, '0' ) ?: '0', $sourceBase ), $destBase ); } elseif ( extension_loaded( 'bcmath' ) && ( $engine == 'auto' || $engine == 'bcmath' ) ) { $decimal = '0'; foreach ( str_split( strtolower( $input ) ) as $char ) { -- 2.20.1