1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
From 9352cc3a587c91c155cfbc7ca4a2a3688d21b686 Mon Sep 17 00:00:00 2001
From: Danack <Danack@basereality.com>
Date: Fri, 7 Jan 2022 15:00:03 +0000
Subject: [PATCH] Work around 4294967295 being above PHP_INT_MAX on 32bit arch.
---
util/functions.php | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/util/functions.php b/util/functions.php
index a57a2483..d69baf48 100644
--- a/util/functions.php
+++ b/util/functions.php
@@ -223,22 +223,22 @@ function get_epsilon_for_off_by_half_errors()
{
// These could be defined better...
$epsilon_values_for_non_hdri = [
- 255 => (1 / (pow(2, 8) - 1)) + 0.0000000000001,
- 65535 => (1 / (pow(2, 16) - 1)) + 0.0000000000001,
- 16777215 => (1 / (pow(2, 24) - 1) ) + 0.0000000000001,
- 4294967295 => (1 / (pow(2, 32) - 1)) + 0.0000000000001,
+ '255' => (1 / (pow(2, 8) - 1)) + 0.0000000000001,
+ '65535' => (1 / (pow(2, 16) - 1)) + 0.0000000000001,
+ '16777215' => (1 / (pow(2, 24) - 1) ) + 0.0000000000001,
+ '4294967295' => (1 / (pow(2, 32) - 1)) + 0.0000000000001,
];
// These could definitely be defined better...
$epsilon_values_for_hdri = [
- 255 => 0.0000000000001,
- 65535 => 0.0000000000001,
- 16777215 => 0.0000000000001,
- 4294967295 => 0.0000000000001
+ '255' => 0.0000000000001,
+ '65535' => 0.0000000000001,
+ '16777215' => 0.0000000000001,
+ '4294967295' => 0.0000000000001
];
if (Imagick::getHdriEnabled() === false) {
- $quantum = Imagick::getQuantum();
+ $quantum = (string)Imagick::getQuantum();
if (array_key_exists($quantum, $epsilon_values_for_non_hdri) !== true) {
throw new Exception(
"Quantum values is $quantum which is not any of (2^(8|16|24|32)) - 1. Please report this as a bug."
|