summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2023-04-14 17:38:01 +1200
committerOlly Betts <olly@survex.com>2023-04-14 17:38:01 +1200
commite3b112c69ceed5c39cb07fa45a3ba62b27712679 (patch)
treec7c771a2b1d09862632facdf01ae10a05e2d61a4 /Lib
parent33f6a2d0b2c3d90b928f56ddfa599afe87903f76 (diff)
downloadswig-e3b112c69ceed5c39cb07fa45a3ba62b27712679.tar.gz
Remove support for PHP7
PHP7 security support ended 2022-11-28 so it doesn't make sense to include support for it in the SWIG 4.2.x release series.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/php/const.i2
-rw-r--r--Lib/php/phprun.swg67
2 files changed, 3 insertions, 66 deletions
diff --git a/Lib/php/const.i b/Lib/php/const.i
index a74af0d78..1e1fe9cad 100644
--- a/Lib/php/const.i
+++ b/Lib/php/const.i
@@ -95,7 +95,7 @@
SWIG_SetPointerZval(&c.value, (void*)($value), $1_descriptor, 0);
zval_copy_ctor(&c.value);
c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0);
- SWIG_ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number);
+ ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number);
zend_register_constant(&c);
}
diff --git a/Lib/php/phprun.swg b/Lib/php/phprun.swg
index d3ad0d26a..588701f9b 100644
--- a/Lib/php/phprun.swg
+++ b/Lib/php/phprun.swg
@@ -10,35 +10,14 @@
extern "C" {
#endif
-#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
+#if PHP_MAJOR_VERSION < 8
+# error These bindings need PHP 8 or later - to generate PHP7 bindings use SWIG < 4.1.0; to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5
#endif
#include "zend_inheritance.h"
#include "zend_exceptions.h"
#include "zend_inheritance.h"
-#if PHP_MAJOR_VERSION == 7
-/* These macros were new in PHP 8.0. For PHP 7.x we define them to give the
- * same result except without any type declarations. PHP 7.x supports type
- * declarations, but not for the return type, and alternate types aren't
- * supported, so we don't try to support these.
- */
-# define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(name, byref, num_req, classes, types) \
- ZEND_BEGIN_ARG_INFO_EX(name, 0, byref, num_req)
-# define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(name, byref, num_req, types) \
- ZEND_BEGIN_ARG_INFO_EX(name, 0, byref, num_req)
-
-/* NB We can just ignore `default` here we currently always pass NULL for it
- * (this mechanism for specifying default parameter values was new in PHP 8.0
- * so it's not useful while we still want to support PHP7 too).
- */
-# define ZEND_ARG_OBJ_TYPE_MASK(byref, name, classes, types, default) \
- ZEND_ARG_INFO(byref, name)
-# define ZEND_ARG_TYPE_MASK(byref, name, types, default) \
- ZEND_ARG_INFO(byref, name)
-#endif
-
#include <stdlib.h> /* for abort(), used in generated code. */
#define SWIG_BOOL_CONSTANT(N, V) REGISTER_BOOL_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT)
@@ -50,27 +29,6 @@ extern "C" {
REGISTER_STRINGL_CONSTANT(#N, &swig_char, 1, CONST_CS | CONST_PERSISTENT);\
} while (0)
-/* ZEND_CONSTANT_SET_FLAGS was new in PHP 7.3. */
-#ifdef ZEND_CONSTANT_SET_FLAGS
-# define SWIG_ZEND_CONSTANT_SET_FLAGS ZEND_CONSTANT_SET_FLAGS
-#else
-# define SWIG_ZEND_CONSTANT_SET_FLAGS(C, F, N) do { (C)->flags = (F); (C)->module_number = (N); } while (0)
-#endif
-
-/* zend_object_alloc was new in PHP 7.3. */
-#if PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION < 3
-static zend_always_inline void *zend_object_alloc(size_t obj_size, zend_class_entry *ce) {
- void *obj = emalloc(obj_size + zend_object_properties_size(ce));
- memset(obj, 0, obj_size - sizeof(zval));
- return obj;
-}
-#endif
-
-/* ZEND_THIS was new in PHP 7.4. */
-#ifndef ZEND_THIS
-# define ZEND_THIS &EX(This)
-#endif
-
#ifdef __cplusplus
}
#endif
@@ -93,27 +51,6 @@ static int default_error_code = E_ERROR;
static zend_class_entry SWIG_Php_swig_wrapped_interface_ce;
-#if PHP_MAJOR_VERSION == 7
-/* zend_class_implements_interface() was new in PHP 8.0.
- *
- * We could use instanceof_function_ex(C, I, 1) here for 7.4, but for 7.3
- * and earlier that doesn't work, so instead we just provide a compatibility
- * implementation which does what zend_class_implements_interface() does in 8.x
- * and use that for all 7.x so there are fewer variants to worry about testing.
- */
-static int zend_class_implements_interface(const zend_class_entry *class_ce, const zend_class_entry *interface_ce) {
- uint32_t i;
- if (class_ce->num_interfaces) {
- for (i = 0; i < class_ce->num_interfaces; i++) {
- if (class_ce->interfaces[i] == interface_ce) {
- return 1;
- }
- }
- }
- return 0;
-}
-#endif
-
/* used to wrap returned objects in so we know whether they are newobject
and need freeing, or not */
typedef struct {