compatible to PHP 7.4

This commit is contained in:
CismonX 2019-12-10 04:50:01 +08:00
parent 8d9f4d773b
commit 426d80e5b1
4 changed files with 12 additions and 8 deletions

View File

@ -7,6 +7,7 @@ php:
- 7.1
- 7.2
- 7.3
- 7.4
script:
- phpize

View File

@ -6,12 +6,6 @@
#include "php_collections_me.h"
// ZEND_ACC_CTOR is removed in PHP 7.4
// Removing the flag does not affect the constructor from being recognized.
#if PHP_VERSION_ID >= 70400
#define ZEND_ACC_CTOR 0
#endif
ZEND_BEGIN_ARG_INFO(action_arginfo, 0)
ZEND_ARG_CALLABLE_INFO(0, action, 0)
ZEND_END_ARG_INFO()

View File

@ -691,9 +691,12 @@ void collection_write_dimension(zval* object, zval* offset, zval* value)
Z_TRY_ADDREF_P(value);
}
void collection_write_property(zval* object, zval* member, zval* value, void** unused)
zobj_write_prop_ret_t collection_write_property(zval* object, zval* member, zval* value, void** unused)
{
collection_write_dimension(object, member, value);
#if PHP_VERSION_ID > 70400
return value;
#endif
}
zval* collection_read_dimension(zval* object, zval* offset, int type, zval* rv)

View File

@ -30,6 +30,12 @@ extern zend_module_entry collections_module_entry;
#error "This extension requires PHP 7.1 and above."
#endif
#if PHP_VERSION_ID >= 70400
typedef zval* zobj_write_prop_ret_t;
#else
typedef void zobj_write_prop_ret_t;
#endif
#define PHP_COLLECTIONS_COMPARE_NATURAL (1 << 0)
#define PHP_COLLECTIONS_FOLD_CASE (1 << 1)
@ -62,7 +68,7 @@ void collection_write_dimension(zval* object, zval* offset, zval* value);
zval* collection_read_dimension(zval* object, zval* offset, int type, zval* rv);
void collection_unset_dimension(zval* object, zval* offset);
int collection_has_property(zval* object, zval* member, int has_set_exists, void**);
void collection_write_property(zval* object, zval* member, zval* value, void**);
zobj_write_prop_ret_t collection_write_property(zval* object, zval* member, zval* value, void**);
zval* collection_read_property(zval* object, zval* member, int type, void**, zval* rv);
void collection_unset_property(zval* object, zval* member, void**);