summaryrefslogtreecommitdiffstats
path: root/imagick-php81.patch
blob: 86c71ae2fcdc442e51e2c57b257c1e910f23e21c (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
From 28508a8b376a866a653ae4fba5d920d8277c83a3 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 21 Jul 2021 10:53:38 +0200
Subject: [PATCH] fix for PHP 8.1.0beta1

---
 Imagick.stub.php               | 12 ++++++++----
 ImagickPixelIterator.stub.php  | 14 +++++++++-----
 ImagickPixelIterator_arginfo.h |  5 +++--
 Imagick_arginfo.h              |  5 +++--
 regen_arginfo.sh               |  4 ++--
 shim_php7_to_php8.h            |  7 ++++++-
 6 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/Imagick.stub.php b/Imagick.stub.php
index b1189b64..7fe3ed82 100644
--- a/Imagick.stub.php
+++ b/Imagick.stub.php
@@ -1223,11 +1223,15 @@ public function key(): int  {}
 //# endif
 //#endif
 
-    /** @alias Imagick::nextImage */
-    public function next(): bool  {}
+    /** @alias Imagick::nextImage
+     *  @tentative-return-type
+     */
+    public function next(): void  {}
 
-    /** @alias Imagick::setFirstIterator */
-    public function rewind(): bool  {}
+    /** @alias Imagick::setFirstIterator
+     *  @tentative-return-type
+     */
+    public function rewind(): void  {}
 
     public function valid(): bool  {}
 
diff --git a/ImagickPixelIterator.stub.php b/ImagickPixelIterator.stub.php
index 8a5b7cde..96072333 100644
--- a/ImagickPixelIterator.stub.php
+++ b/ImagickPixelIterator.stub.php
@@ -30,11 +30,15 @@ public function getPreviousIteratorRow(): array {}
     /** @alias ImagickPixelIterator::getIteratorRow */
     public function key(): int {}
 
-    /** @alias ImagickPixelIterator::getNextIteratorRow */
-    public function next(): array {}
+    /** @alias ImagickPixelIterator::getNextIteratorRow
+     *  @tentative-return-type
+     */
+    public function next(): void {}
 
-    /** @alias ImagickPixelIterator::resetIterator */
-    public function rewind(): bool {}
+    /** @alias ImagickPixelIterator::resetIterator
+     *  @tentative-return-type
+     */
+    public function rewind(): void {}
 
     /** @alias ImagickPixelIterator::getCurrentIteratorRow */
     public function current(): array {}
@@ -59,4 +63,4 @@ public function setIteratorRow(int $row): bool {}
     public function syncIterator(): bool {}
 
     public function valid(): bool {}
-}
\ No newline at end of file
+}
diff --git a/ImagickPixelIterator_arginfo.h b/ImagickPixelIterator_arginfo.h
index ef20a02e..26237941 100644
--- a/ImagickPixelIterator_arginfo.h
+++ b/ImagickPixelIterator_arginfo.h
@@ -85,9 +85,10 @@ ZEND_END_ARG_INFO()
 
 #define arginfo_class_ImagickPixelIterator_key arginfo_class_ImagickPixelIterator_getIteratorRow
 
-#define arginfo_class_ImagickPixelIterator_next arginfo_class_ImagickPixelIterator_getCurrentIteratorRow
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_ImagickPixelIterator_next, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
 
-#define arginfo_class_ImagickPixelIterator_rewind arginfo_class_ImagickPixelIterator_clear
+#define arginfo_class_ImagickPixelIterator_rewind arginfo_class_ImagickPixelIterator_next
 
 #define arginfo_class_ImagickPixelIterator_current arginfo_class_ImagickPixelIterator_getCurrentIteratorRow
 
diff --git a/Imagick_arginfo.h b/Imagick_arginfo.h
index db2b2ee5..2df4076c 100644
--- a/Imagick_arginfo.h
+++ b/Imagick_arginfo.h
@@ -4786,11 +4786,12 @@ ZEND_END_ARG_INFO()
 #endif
 
 #if MagickLibVersion > 0x628
-#define arginfo_class_Imagick_next arginfo_class_Imagick_optimizeImageLayers
+ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Imagick_next, 0, 0, IS_VOID, 0)
+ZEND_END_ARG_INFO()
 #endif
 
 #if MagickLibVersion > 0x628
-#define arginfo_class_Imagick_rewind arginfo_class_Imagick_optimizeImageLayers
+#define arginfo_class_Imagick_rewind arginfo_class_Imagick_next
 #endif
 
 #if MagickLibVersion > 0x628
diff --git a/regen_arginfo.sh b/regen_arginfo.sh
index 96c24cea..1df4ade5 100755
--- a/regen_arginfo.sh
+++ b/regen_arginfo.sh
@@ -2,9 +2,9 @@
 
 VER=0$(php-config --vernum 2>/dev/null)
 
-if [ $VER -lt 70100 ]; then
+if [ $VER -lt 80100 ]; then
 
-	echo "You need php >= 7.1 to run this script"
+	echo "You need php >= 8.1 to run this script"
 
 elif [ ! -f build/gen_stub.php ]; then
 
diff --git a/shim_php7_to_php8.h b/shim_php7_to_php8.h
index 5f8d89b4..7c4e92c7 100644
--- a/shim_php7_to_php8.h
+++ b/shim_php7_to_php8.h
@@ -1,5 +1,10 @@
 
 
+#if PHP_VERSION_ID < 80100
+#define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \
+        ZEND_BEGIN_ARG_INFO_EX(name, return_reference, required_num_args, allow_null)
+#endif
+
 #if PHP_VERSION_ID < 80000
 // Allow the generated stubs to work on previous versions of PHP
 
@@ -11,4 +16,4 @@
 
 #define MAY_BE_STRING ""
 
-#endif
\ No newline at end of file
+#endif