Skip to content

Commit 997fea3

Browse files
authored
Fix 'non-well formed number notice' issue in PHP 7.2
try Fix 'non-well formed number notice' issue in PHP 7.2 or PHP 7.1
1 parent 5c1224a commit 997fea3

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

server/php/UploadHandler.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,15 +375,22 @@ protected function get_error_message($error) {
375375
}
376376

377377
public function get_config_bytes($val) {
378-
$val = trim($val);
379-
$last = strtolower($val[strlen($val)-1]);
380-
$val = (int)$val;
381-
switch ($last) {
378+
$str = trim($val);
379+
$last = strtolower($str[strlen($str)-1]);
380+
if(is_numeric($last)) {
381+
$val = (int) $str;
382+
} else {
383+
$val = (int) substr($str, 0, -1);
384+
}
385+
switch($last) {
382386
case 'g':
387+
case 'G':
383388
$val *= 1024;
384389
case 'm':
390+
case 'M':
385391
$val *= 1024;
386392
case 'k':
393+
case 'K':
387394
$val *= 1024;
388395
}
389396
return $this->fix_integer_overflow($val);

0 commit comments

Comments
 (0)