From 55c95d475cc0deebdc35564aa39875fe03d72c35 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Wed, 28 Sep 2022 18:59:31 +1300 Subject: [PATCH] [php] Adapt swig_ptr_cast_object for PHP 8.2 The required return type has changed from int to an enum, which gives a compiler warning when we assign a function pointer. --- Source/Modules/php.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 964456c08..37a58d752 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -148,6 +148,8 @@ static void SwigPHP_emit_pointer_type_registrations() { Printf(s_wrappers, "/* Implement __toString equivalent, since that worked for the old-style resource wrapped pointers. */\n"); Append(s_wrappers, "#if PHP_MAJOR_VERSION < 8\n"); Printf(s_wrappers, "static int swig_ptr_cast_object(zval *z, zval *retval, int type) {\n"); + Append(s_wrappers, "#elif PHP_MAJOR_VERSION > 8 || PHP_MINOR_VERSION >= 2\n"); + Printf(s_wrappers, "static ZEND_RESULT_CODE swig_ptr_cast_object(zend_object *zobj, zval *retval, int type) {\n"); Append(s_wrappers, "#else\n"); Printf(s_wrappers, "static int swig_ptr_cast_object(zend_object *zobj, zval *retval, int type) {\n"); Append(s_wrappers, "#endif\n");