Files
buildroot/package/php-lua
Alexis Lothoré a1daf153bf package/php-lua: fix build with lua < 5.2
php-lua fails to build in buildroot 2025.08-rc3 on the following error:

in file included from [...]/usr/include/php/Zend/zend.h:32,
                 from [...]/usr/include/php/main/php.h:31,
                 from [...]/build/php-lua-2.0.7/lua.c:24:
[...]/build/php-lua-2.0.7/lua.c: In function ‘php_lua_write_property’:
[...]/build/php-lua-2.0.7/lua.c:247:37:
error: ‘val’ undeclared (first use in this function); did you mean
‘zval’?
  247 |         lua_pushlstring(L, ZSTR_VAL(val), ZSTR_LEN(val));
      |                                     ^~~
[...]/usr/include/php/Zend/zend_string.h:66:26:
note: in definition of macro ‘ZSTR_VAL’
   66 | #define ZSTR_VAL(zstr)  (zstr)->val
      |                          ^~~~
[...]/build/php-lua-2.0.7/lua.c:247:37:
note: each undeclared identifier is reported only once for each function
it appears in
  247 |         lua_pushlstring(L, ZSTR_VAL(val), ZSTR_LEN(val));
      |                                     ^~~
[...]/usr/include/php/Zend/zend_string.h:66:26:
note: in definition of macro ‘ZSTR_VAL’
   66 | #define ZSTR_VAL(zstr)  (zstr)->val
      |                          ^~~~
make[2]: *** [Makefile:214: lua.lo] Error 1

The issue triggers only if lua interpreter version is lower than 5.2. In
this case,  php_lua_write_property calls ZSTR_VAL on the wrong variable.

Fix php-lua build by calling ZSTR_VAL on the correct variable.

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/11271124501 (TestPhpLuaLuajit)

Suggested-by: Romain Naour <romain.naour@smile.fr>
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
[Romain: add link to failing TestPhpLuaLuajit]
Signed-off-by: Romain Naour <romain.naour@smile.fr>
2025-09-10 22:17:07 +02:00
..