0004-lua.c-fix-ZSTR_VAL-usage-when-using-lua-5.2.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From 7bf334832ad36d1f2976406d680b35a168ffaa91 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= <alexis.lothore@bootlin.com>
  3. Date: Mon, 8 Sep 2025 17:20:12 +0200
  4. Subject: [PATCH] lua.c: fix ZSTR_VAL usage when using lua < 5.2
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. When using a lua interpreter with a version lower than 5.1, the
  9. php_lua_write_property ends up calling the ZSTR_VAL with the wrong
  10. variable (it is expected to receive "member", a zend_string variable,
  11. but it is "value" that is passed, which is a zval).
  12. Fix php-lua compatibility with interpreters < 5.2 by passing the correct
  13. variable
  14. Upstream: upstream dead, custom patch
  15. Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
  16. ---
  17. lua.c | 2 +-
  18. 1 file changed, 1 insertion(+), 1 deletion(-)
  19. diff --git a/lua.c b/lua.c
  20. index a40e5da442a4..5889bc7f83ea 100755
  21. --- a/lua.c
  22. +++ b/lua.c
  23. @@ -244,7 +244,7 @@ static zval* php_lua_write_property(zend_object *object, zend_string *member, zv
  24. lua_State *L = php_lua_obj_from_obj(object)->L;
  25. #if (LUA_VERSION_NUM < 502)
  26. - lua_pushlstring(L, ZSTR_VAL(val), ZSTR_LEN(val));
  27. + lua_pushlstring(L, ZSTR_VAL(member), ZSTR_LEN(member));
  28. php_lua_send_zval_to_lua(L, value);
  29. lua_settable(L, LUA_GLOBALSINDEX);
  30. --
  31. 2.51.0