Skip to content

Commit e8a3335

Browse files
committed
Don't rely on PHP_INT_MIN if it isn't defined (PHP < 7).
1 parent 3f2166f commit e8a3335

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/FontLib/BinaryStream.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,11 @@ public function writeFixed($data) {
274274
public function readLongDateTime() {
275275
$this->readUInt32(); // ignored
276276
$date = $this->readUInt32() - 2082844800;
277+
278+
# PHP_INT_MIN isn't defined in PHP < 7.0
279+
$php_int_min = defined("PHP_INT_MIN") ? PHP_INT_MIN : ~PHP_INT_MAX;
277280

278-
if (is_string($date) || $date > PHP_INT_MAX || $date < PHP_INT_MIN) {
281+
if (is_string($date) || $date > PHP_INT_MAX || $date < $php_int_min) {
279282
$date = 0;
280283
}
281284

0 commit comments

Comments
 (0)