Skip to content

Commit

Permalink
Fix PHP8 build (zend_compile_string change) (#3675)
Browse files Browse the repository at this point in the history
  • Loading branch information
twose authored Sep 18, 2020
1 parent c270168 commit bebc3a0
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions php_swoole_cxx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ SW_API zend_string **sw_zend_known_strings = nullptr;

//----------------------------------Swoole known string------------------------------------

static zend_op_array *swoole_compile_string(zval *source_string, ZEND_STR_CONST char *filename);
#if PHP_VERSION_ID < 80000
typedef zval zend_source_string_t;
#else
typedef zend_string zend_source_string_t;
#endif

static zend_op_array *swoole_compile_string(zend_source_string_t *source_string, ZEND_STR_CONST char *filename);

bool zend::include(std::string file) {
zend_file_handle file_handle;
Expand Down Expand Up @@ -51,9 +57,10 @@ bool zend::include(std::string file) {
}

// for compatibly with dis_eval
static zend_op_array *(*old_compile_string)(zval *source_string, ZEND_STR_CONST char *filename);

static zend_op_array *swoole_compile_string(zval *source_string, ZEND_STR_CONST char *filename) {
static zend_op_array *(*old_compile_string)(zend_source_string_t *source_string, ZEND_STR_CONST char *filename);

static zend_op_array *swoole_compile_string(zend_source_string_t *source_string, ZEND_STR_CONST char *filename) {
zend_op_array *opa = old_compile_string(source_string, filename);
opa->type = ZEND_USER_FUNCTION;
return opa;
Expand Down

0 comments on commit bebc3a0

Please sign in to comment.