Skip to content

Commit

Permalink
Support php 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzhiming1 committed Nov 13, 2020
1 parent 4ae7024 commit 2d20bb4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
9 changes: 6 additions & 3 deletions donkeyid.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_donkeyid_parseId, 0, 0, 0)
ZEND_ARG_INFO(0, id)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_void, 0, 0, 0)
ZEND_END_ARG_INFO()

/* Remove the following function when you have successfully modified config.m4
so that your module can be compiled into PHP, it exists only for testing
purposes. */
Expand All @@ -70,13 +73,13 @@ ZEND_END_ARG_INFO()
* Every user visible function must have an entry in donkeyid_functions[].
*/
const zend_function_entry donkeyid_methods[] = {
PHP_FE(dk_get_next_id, NULL)
PHP_FE(dk_get_next_id, arginfo_void)
PHP_FE(dk_get_next_ids, arginfo_donkeyid_getIdByTime)
PHP_FE(dk_parse_id, arginfo_donkeyid_parseId)
PHP_FE(dk_get_ts_id, NULL)
PHP_FE(dk_get_ts_id, arginfo_void)
PHP_FE(dk_get_ts_ids, arginfo_donkeyid_getIdByTime)
PHP_FE(dk_parse_ts_id, arginfo_donkeyid_parseId)
PHP_FE(dk_get_dt_id, NULL)
PHP_FE(dk_get_dt_id, arginfo_void)
PHP_FE_END /* Must be the last line in donkeyid_functions[] */
};
/* }}} */
Expand Down
2 changes: 1 addition & 1 deletion php_donkeyid.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
extern zend_module_entry donkeyid_module_entry;
#define phpext_donkeyid_ptr &donkeyid_module_entry

#define PHP_DONKEYID_VERSION "1.0.1" /* Replace with version number for your extension */
#define PHP_DONKEYID_VERSION "1.1.1" /* Replace with version number for your extension */

#ifdef PHP_WIN32
# define PHP_DONKEYID_API __declspec(dllexport)
Expand Down
14 changes: 9 additions & 5 deletions php_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#if PHP_MAJOR_VERSION < 7

#define dk_zend_read_property zend_read_property
#define DK_RETURN_STRINGL RETURN_STRINGL
typedef int zend_size_t;

Expand All @@ -23,15 +22,20 @@ typedef int zend_size_t;
#define dk_add_next_index_stringl(a,s,l,d) add_next_index_stringl(a,s,l)
#define dk_add_assoc_stringl_ex(a,ks,kl,s,l,d) add_assoc_stringl_ex(a,ks,kl,s,l)

static inline zval* dk_zend_read_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_bool silent){
zval rv;
return zend_read_property(scope,object,name,name_length,silent,&rv);
}
typedef size_t zend_size_t;

#endif



#if PHP_VERSION_ID >= 80000
#define TSRMLS_C
#define TSRMLS_CC
#define TSRMLS_D
#define TSRMLS_DC
#define TSRMLS_FETCH_FROM_CTX(ctx)
#define TSRMLS_SET_CTX(ctx)
#endif


#endif //DONKEYID_PHP_WRAPPER_H

0 comments on commit 2d20bb4

Please sign in to comment.