Source: php-luasandbox
Version: 4.1.4-1
Severity: important
Tags: ftbfs patch
Control: tags -1 + fixed-upstream
Control: block 1149581 by -1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,

php-luasandbox fails to build with PHP 8.6, which is in experimental and
becomes the default in unstable with the php8.6 transition (#1149581):

  luasandbox_types.h:106:54: error: implicit declaration of function 
'XtOffsetOf'; did you mean 'offsetof'? [-Wimplicit-function-declaration]
  luasandbox_types.h:106:65: error: expected expression before 
'php_luasandbox_obj'
  data_conversion.c:334:33: error: implicit declaration of function 'zval_dtor' 
[-Wimplicit-function-declaration]

PHP 8.6 removed the XtOffsetOf() alias of offsetof() and the zval_dtor()
alias of zval_ptr_dtor_nogc() (see UPGRADING.INTERNALS).

Upstream fixed this in the first commit after the 4.1.4 tag, "Fix build
with PHP 8.6.0alpha3" by Remi Collet:

  
https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/php/luasandbox/+/15054f4575aa02876e49947c2369faa62cf6563d

There is no upstream release with it yet, so the attached patch is that
commit with a DEP-3 header. It applies to 4.1.4-1 unchanged.

With the patch, in an sbuild chroot with php8.6 8.6.0-3 and php-defaults
108~exp2 from experimental:

  * the package builds and its tests pass (20 passed, 0 failed, and
    timer.phpt as the expected failure it already is);
  * the autopkgtest passes with php8.6-cli.

The patched extension also builds and passes its tests with PHP 8.2 to
8.5.


- -- System Information:
Debian Release: 13.8
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 
'stable-debug'), (500, 'proposed-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.12.117+deb13-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_IE:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEw2Gx4wKVQ+vGJel9g3Kkd++uWcIFAmsKoBhfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEMz
NjFCMUUzMDI5NTQzRUJDNjI1RTk3RDgzNzJBNDc3RUZBRTU5QzIACgkQg3Kkd++u
WcJ2PA/8CFl9eH62pwQ+DOA+U7Rkk3u5k9440hSc/IOZSkqejDJcWTqnYqVw/ZqX
hCSu90+1ioVYr8+FxFYvGFH5uXSq2LnhomQYF1rwkXhErRFSSNaMgBcl6ImRsKv/
HRQ0kwSRZtBt56Bo7UjRYnMOwmJXru3uiF+stazs+GqbgQDFsjIH3ncb+8Q2FP7O
hxqSULimuKLNMwJuQZqf4FP4JQ5L8BYId188MfbC909gzS4tSAS2FvdZcy+rHIub
EyzB7MU066bFgVLb+bzJwL9SaTURFLshHMGdDmEU6X/mLaJ10E/elEON6qGhln1Q
P0wFzEehMT/kXD/cS5xHtU7mPyBZFugHbMmkpcnTbqwn64RNmA3I8ZzH0K4gpD2i
dbmSavsZ2kgB4p4Kf/BFWMqIPQ8gS5bzxv1T/15KMOUuuRds0oqRJPfMnMJ3Dplp
oC0BzvKCP+24z5KY4ecP81EEVM5zkyIFEZtAZQrIAiXOYD3rmNemOlKax2bmCfJ3
FrW+VMIEdvSuH/nCcSjCToOOhpgfZhrM8r5mn8gyjmYJBsm4bA9SeK3ZBZJN7Xrm
sT+QAijNp8LQzrneGO94MG2l71lLBMQnRtA9LIivoNqx2iadc5E7V4orl84hLi2D
NxE8Qx3tspGsujgCqar0Mz08Q9R0cIda/chD9rpocLUIvB5yePk=
=kZqC
-----END PGP SIGNATURE-----
From: Remi Collet <[email protected]>
Date: Thu, 30 Jul 2026 06:06:44 +0200
Subject: Fix build with PHP 8.6.0alpha3

  . The zval_dtor() alias of zval_ptr_dtor_nogc() has been removed.
    Call zval_ptr_dtor_nogc() directly instead.

  . The XtOffsetOf() alias of C’s offsetof() macro has been removed. Use
    offsetof() directly.

Originally submitted as 
https://github.com/wikimedia/mediawiki-php-luasandbox/pull/3

Change-Id: I21640ced37075dd246275b1c8a0da86005a6042c

Origin: upstream, 
https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/php/luasandbox/+/15054f4575aa02876e49947c2369faa62cf6563d
Forwarded: not-needed
Applied-Upstream: commit 15054f4575aa02876e49947c2369faa62cf6563d, after 4.1.4
Last-Update: 2026-11-28
---
 data_conversion.c  | 2 +-
 luasandbox.c       | 4 ++--
 luasandbox_types.h | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/data_conversion.c b/data_conversion.c
index 2d5b2b6..2ece11e 100644
--- a/data_conversion.c
+++ b/data_conversion.c
@@ -331,7 +331,7 @@ int luasandbox_lua_to_zval(zval * z, lua_State * L, int 
index,
 
                        if (!success) {
                                // free the array created by array_init() above.
-                               zval_dtor(z);
+                               zval_ptr_dtor_nogc(z);
                                ZVAL_NULL(z);
                                return 0;
                        }
diff --git a/luasandbox.c b/luasandbox.c
index 4d65a26..7a69f23 100644
--- a/luasandbox.c
+++ b/luasandbox.c
@@ -286,10 +286,10 @@ PHP_MINIT_FUNCTION(luasandbox)
        luasandboxfunction_ce->create_object = luasandboxfunction_new;
 
        memcpy(&luasandbox_object_handlers, zend_get_std_object_handlers(), 
sizeof(zend_object_handlers));
-       luasandbox_object_handlers.offset = XtOffsetOf(php_luasandbox_obj, std);
+       luasandbox_object_handlers.offset = offsetof(php_luasandbox_obj, std);
        luasandbox_object_handlers.free_obj = 
(zend_object_free_obj_t)luasandbox_free_storage;
        memcpy(&luasandboxfunction_object_handlers, 
zend_get_std_object_handlers(), sizeof(zend_object_handlers));
-       luasandboxfunction_object_handlers.offset = 
XtOffsetOf(php_luasandboxfunction_obj, std);
+       luasandboxfunction_object_handlers.offset = 
offsetof(php_luasandboxfunction_obj, std);
        luasandboxfunction_object_handlers.free_obj = 
(zend_object_free_obj_t)luasandboxfunction_free_storage;
 
        luasandbox_timer_minit();
diff --git a/luasandbox_types.h b/luasandbox_types.h
index 329eba6..34cb02e 100644
--- a/luasandbox_types.h
+++ b/luasandbox_types.h
@@ -103,11 +103,11 @@ typedef struct _php_luasandboxfunction_obj 
php_luasandboxfunction_obj;
 
 // Accessor macros
 static inline php_luasandbox_obj *php_luasandbox_fetch_object(zend_object 
*obj) {
-       return (php_luasandbox_obj *)((char*)(obj) - 
XtOffsetOf(php_luasandbox_obj, std));
+       return (php_luasandbox_obj *)((char*)(obj) - 
offsetof(php_luasandbox_obj, std));
 }
 
 static inline php_luasandboxfunction_obj 
*php_luasandboxfunction_fetch_object(zend_object *obj) {
-       return (php_luasandboxfunction_obj *)((char*)(obj) - 
XtOffsetOf(php_luasandboxfunction_obj, std));
+       return (php_luasandboxfunction_obj *)((char*)(obj) - 
offsetof(php_luasandboxfunction_obj, std));
 }
 
 #define GET_LUASANDBOX_OBJ(z) php_luasandbox_fetch_object(Z_OBJ_P(z))

Reply via email to