Skip to content

Commit

Permalink
Merge pull request #1 from lbenothman/2.15.2_fixed_for_PHP_7.2_by_cro…
Browse files Browse the repository at this point in the history
…ssknowledge

PHP 7.2 compatibilty
  • Loading branch information
Jtillaud authored Jul 20, 2018
2 parents 0999ab4 + 5c9d53e commit 8f09b73
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions classes/phing/Phing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 8f09b73

Please sign in to comment.