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

Index: Lib/exception.i
--- Lib/exception.i.orig
+++ Lib/exception.i
@@ -12,7 +12,7 @@
 %insert("runtime") "swigerrors.swg"
 
 
-#ifdef SWIGPHP7
+#ifdef SWIGPHP
 %{
 #include "zend_exceptions.h"
 #define SWIG_exception(code, msg) do { zend_throw_exception(NULL, (char*)msg, code); goto thrown; } while (0)
