Skip to content

Commit c47dd0d

Browse files
Forstnorberttech
authored andcommitted
Force $binaryPrefixes array ordering on 32-bit systems, fixes #83 (#87)
1 parent ae4d197 commit c47dd0d

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/Coduo/PHPHumanizer/String/BinarySuffix.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ public function __construct($number, $locale = 'en', $precision = null)
4747

4848
$this->number = (int) $number;
4949
$this->locale = $locale;
50+
51+
/*
52+
* Workaround for 32-bit systems which ignore array ordering when
53+
* dropping values over 2^32-1
54+
*/
55+
krsort($this->binaryPrefixes);
5056
}
5157

5258
public function convert()

src/Coduo/PHPHumanizer/String/MetricSuffix.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ public function __construct($number, $locale = 'en')
4242

4343
$this->number = (int) $number;
4444
$this->locale = $locale;
45+
46+
/*
47+
* Workaround for 32-bit systems which ignore array ordering when
48+
* dropping values over 2^32-1
49+
*/
50+
krsort($this->binaryPrefixes);
4551
}
4652

4753
public function convert()

0 commit comments

Comments
 (0)