[php] Fix function constants for PHP 7.3

The code we were generating no longer compiled.
This commit is contained in:
Olly Betts 2019-02-08 14:49:23 +13:00
commit 9f84ca8a00
2 changed files with 8 additions and 2 deletions

View file

@ -60,8 +60,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);
c.flags = CONST_CS;
c.module_number = module_number;
SWIG_ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number);
zend_register_constant(&c);
}

View file

@ -32,6 +32,13 @@ extern "C" {
REGISTER_STRINGL_CONSTANT(#N, &swig_char, 1, CONST_CS | CONST_PERSISTENT);\
} while (0)
/* ZEND_CONSTANT_SET_FLAGS is 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
#ifdef __cplusplus
}
#endif