backport php 8 support from upstream
https://github.com/swig/swig/pull/1978 via
https://src.fedoraproject.org/rpms/swig/c/62dded8bacb09398b03d1352820636182d2494ab

Index: Lib/php/phprun.swg
--- Lib/php/phprun.swg.orig
+++ Lib/php/phprun.swg
@@ -12,8 +12,8 @@ extern "C" {
 #include "zend_exceptions.h"
 #include "php.h"
 
-#if PHP_MAJOR_VERSION != 7
-# error These bindings need PHP7 - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
+#if PHP_MAJOR_VERSION < 7
+# error These bindings need PHP 7 or later - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
 #endif
 
 #include "ext/standard/php_string.h"
@@ -204,7 +204,11 @@ SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *t
 
   switch (Z_TYPE_P(z)) {
     case IS_OBJECT: {
+#if PHP_MAJOR_VERSION < 8
       HashTable * ht = Z_OBJ_HT_P(z)->get_properties(z);
+#else
+      HashTable * ht = Z_OBJ_HT_P(z)->get_properties(Z_OBJ_P(z));
+#endif
       if (ht) {
         zval * _cPtr = zend_hash_str_find(ht, "_cPtr", sizeof("_cPtr") - 1);
         if (_cPtr) {
