projects/aports·blob master · refs

42 lines · 1.6 KiB

1Patch-Source: https://github.com/php/pecl-php-uploadprogress/pull/19
2From 1784fabd6543c6d563c4658714a5536d901e2f04 Mon Sep 17 00:00:00 2001
3From: Andy Postnikov <[email protected]>
4Date: Wed, 1 Jul 2026 02:48:21 +0200
5Subject: [PATCH] Fix build against PHP 8.6 (INI_STR/INI_BOOL macros removed)
6
7PHP 8.6 removed the legacy uppercase INI_STR() and INI_BOOL() macros in
8favour of the lowercase zend_ini_string()/zend_ini_long() helpers, which
9have been available since PHP 7. Building against 8.6 therefore fails with
10implicit-function-declaration errors.
11
12Add guarded fallback definitions so the extension keeps compiling on both
13older and newer PHP versions without touching the call sites.
14
15Ref: https://github.com/php/php-src/commit/df8ce6ddbd713d7e9163dd60d19648e2e4a8bb80
16
17Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
18---
19 uploadprogress.c | 10 ++++++++++
20 1 file changed, 10 insertions(+)
21
22diff --git a/uploadprogress.c b/uploadprogress.c
23index 57f6f0b..d266b9a 100644
24--- a/uploadprogress.c
25+++ b/uploadprogress.c
26@@ -29,6 +29,16 @@
27 #define TMPDIR "/tmp"
28 #endif
29
30+/* PHP 8.6 removed the legacy INI_STR()/INI_BOOL() macros in favour of
31+ * zend_ini_string()/zend_ini_long(). Provide fallbacks so the extension
32+ * keeps building on both older and newer PHP versions. */
33+#ifndef INI_STR
34+# define INI_STR(name) ((char *) zend_ini_string((name), strlen(name), 0))
35+#endif
36+#ifndef INI_BOOL
37+# define INI_BOOL(name) ((bool) zend_ini_long((name), strlen(name), 0))
38+#endif
39+
40 /* {{{ argument information */
41 #if PHP_VERSION_ID < 80000
42 #include "uploadprogress_legacy_arginfo.h"