Support for unsupported PHP versions

This commit is contained in:
Matt Bonneau 2019-12-11 14:47:53 -05:00
parent 830e2f561e
commit 921f838255

View File

@ -77,7 +77,7 @@ class MessageBuffer {
$memory_limit_bytes = 0; $memory_limit_bytes = 0;
if ($memory_limit !== '') { if ($memory_limit !== '') {
$shifty = ['k' => 0, 'm' => 10, 'g' => 20]; $shifty = ['k' => 0, 'm' => 10, 'g' => 20];
$multiplier = strtolower($memory_limit)[-1]; $multiplier = strlen($memory_limit) > 1 ? substr(strtolower($memory_limit), -1) : '';
$memory_limit = (int)$memory_limit; $memory_limit = (int)$memory_limit;
$memory_limit_bytes = in_array($multiplier, array_keys($shifty), true) ? $memory_limit * 1024 << $shifty[$multiplier] : $memory_limit; $memory_limit_bytes = in_array($multiplier, array_keys($shifty), true) ? $memory_limit * 1024 << $shifty[$multiplier] : $memory_limit;
} }