From 5c9d53e9a64680a4567aaf8ea32b6fa4a2422469 Mon Sep 17 00:00:00 2001 From: Ben Othman Lotfi Date: Fri, 20 Jul 2018 11:00:15 +0200 Subject: [PATCH] PHP 7.2 compatibilty --- classes/phing/Phing.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/classes/phing/Phing.php b/classes/phing/Phing.php index e3e63b9e76..8fc1cafc76 100644 --- a/classes/phing/Phing.php +++ b/classes/phing/Phing.php @@ -1627,17 +1627,18 @@ private static function convertShorthand($val) { $val = trim($val); $last = strtolower($val[strlen($val) - 1]); - - switch ($last) { - // The 'G' modifier is available since PHP 5.1.0 - case 'g': - $val *= 1024; - case 'm': - $val *= 1024; - case 'k': - $val *= 1024; + if (!is_numeric($last)) { + $val = (int) substr($val, 0, strlen($val) - 1); + switch ($last) { + // The 'G' modifier is available since PHP 5.1.0 + case 'g': + $val *= 1024; + case 'm': + $val *= 1024; + case 'k': + $val *= 1024; + } } - return $val; }