summaryrefslogtreecommitdiff
path: root/Lib/exception.i
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2021-12-08 13:06:16 +1300
committerOlly Betts <olly@survex.com>2021-12-08 13:10:38 +1300
commitc0c7a8dba06c2dc0fddb6d1e9e56f3eab0fb8271 (patch)
treeef12f89cd227f45f372be345329fe9d9e54c3210 /Lib/exception.i
parent7246cfa6c6e1877cd679a23970da477cad039a28 (diff)
downloadswig-c0c7a8dba06c2dc0fddb6d1e9e56f3eab0fb8271.tar.gz
[php] Fix two incorrect PHP 8 conditionals
The correct macro to test is PHP_MAJOR_VERSION so these two PHP 8 cases weren't ever used, which hid that the PHP8 version of the code was broken in one of them. Highlighted in #2113.
Diffstat (limited to 'Lib/exception.i')
-rw-r--r--Lib/exception.i8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/exception.i b/Lib/exception.i
index 7508b409b..5cdea58e8 100644
--- a/Lib/exception.i
+++ b/Lib/exception.i
@@ -14,14 +14,14 @@
#ifdef SWIGPHP
%{
-#if PHP_MAJOR >= 8
-# define SWIG_HANDLE_VALUE_ERROR_FOR_PHP8 code == SWIG_ValueError ? zend_ce_value_error :
+#if PHP_MAJOR_VERSION >= 8
+# define SWIG_HANDLE_VALUE_ERROR_FOR_PHP8(code) code == SWIG_ValueError ? zend_ce_value_error :
#else
-# define SWIG_HANDLE_VALUE_ERROR_FOR_PHP8
+# define SWIG_HANDLE_VALUE_ERROR_FOR_PHP8(code)
#endif
#define SWIG_exception(code, msg) do { zend_throw_exception( \
code == SWIG_TypeError ? zend_ce_type_error : \
- SWIG_HANDLE_VALUE_ERROR_FOR_PHP8 \
+ SWIG_HANDLE_VALUE_ERROR_FOR_PHP8(code) \
code == SWIG_DivisionByZero ? zend_ce_division_by_zero_error : \
code == SWIG_SyntaxError ? zend_ce_parse_error : \
code == SWIG_OverflowError ? zend_ce_arithmetic_error : \