Add initial support for PHP8

Testcase director_overload2 is failing, but the rest of the testsuite
passes.
This commit is contained in:
Olly Betts 2021-03-17 12:45:17 +13:00
commit 3584c7d49c
11 changed files with 72 additions and 27 deletions

View file

@ -21,7 +21,7 @@ typedef struct SWIGCDATA {
}
%typemap(in) (const void *indata, int inlen) = (char *STRING, int LENGTH);
#elif SWIGPHP7
#elif SWIGPHP
%typemap(out) SWIGCDATA {
ZVAL_STRINGL($result, $1.data, $1.len);

View file

@ -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)

View file

@ -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"
@ -200,7 +200,11 @@ SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) {
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) {