From c63e7a8873821f7df89b31cc45168ffab7e81f6a Mon Sep 17 00:00:00 2001 From: arshidkv12 Date: Wed, 11 Mar 2026 22:36:23 +0530 Subject: [PATCH 1/2] Compile against PHP 8.6 --- ext-src/php_swoole.cc | 12 ++--- ext-src/php_swoole_cxx.cc | 4 +- ext-src/php_swoole_cxx.h | 2 +- ext-src/php_swoole_http.h | 2 +- ext-src/php_swoole_private.h | 8 ++-- ext-src/swoole_async_coro.cc | 8 ++-- ext-src/swoole_client.cc | 20 ++++---- ext-src/swoole_client_async.cc | 2 +- ext-src/swoole_coroutine.cc | 2 +- ext-src/swoole_coroutine_scheduler.cc | 6 +-- ext-src/swoole_event.cc | 2 +- ext-src/swoole_http2_client_coro.cc | 10 ++-- ext-src/swoole_http2_server.cc | 6 +-- ext-src/swoole_http_client_coro.cc | 18 ++++---- ext-src/swoole_http_request.cc | 12 ++--- ext-src/swoole_http_response.cc | 8 ++-- ext-src/swoole_http_server_coro.cc | 22 ++++----- ext-src/swoole_name_resolver.cc | 6 +-- ext-src/swoole_process.cc | 4 +- ext-src/swoole_process_pool.cc | 6 +-- ext-src/swoole_runtime.cc | 40 ++++++++-------- ext-src/swoole_server.cc | 54 +++++++++++----------- ext-src/swoole_server_port.cc | 30 ++++++------ ext-src/swoole_socket_coro.cc | 28 +++++------ ext-src/swoole_stdext.cc | 2 +- ext-src/swoole_table.cc | 2 +- ext-src/swoole_thread.cc | 4 +- ext-src/swoole_thread_arraylist.cc | 2 +- ext-src/swoole_websocket_server.cc | 14 +++--- tests/swoole_curl/basic/22.skip.php | 2 + thirdparty/pdo_oci/oci_statement.c | 2 +- thirdparty/php/curl/multi.cc | 2 +- thirdparty/php/ssh2/ssh2.cc | 2 +- thirdparty/php/ssh2/ssh2_fopen_wrappers.cc | 4 +- thirdparty/php82/pdo_odbc/odbc_stmt.c | 2 +- thirdparty/php83/pdo_odbc/odbc_stmt.c | 2 +- thirdparty/php84/curl/multi.cc | 2 +- thirdparty/php84/pdo_odbc/odbc_stmt.c | 2 +- 38 files changed, 179 insertions(+), 177 deletions(-) create mode 100644 tests/swoole_curl/basic/22.skip.php diff --git a/ext-src/php_swoole.cc b/ext-src/php_swoole.cc index 32e73e122f2..f0f005c3563 100644 --- a/ext-src/php_swoole.cc +++ b/ext-src/php_swoole.cc @@ -395,17 +395,17 @@ void php_swoole_set_global_option(HashTable *vht) { zval *ztmp; #ifdef SW_DEBUG - if (php_swoole_array_get_value(vht, "debug_mode", ztmp) && zval_is_true(ztmp)) { + if (php_swoole_array_get_value(vht, "debug_mode", ztmp) && zend_is_true(ztmp)) { swoole_set_log_level(0); } #endif // [EventLoop] // ====================================================================== if (php_swoole_array_get_value(vht, "enable_signalfd", ztmp)) { - SwooleG.enable_signalfd = zval_is_true(ztmp); + SwooleG.enable_signalfd = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "enable_kqueue", ztmp)) { - SwooleG.enable_kqueue = zval_is_true(ztmp); + SwooleG.enable_kqueue = zend_is_true(ztmp); } // [Logger] // ====================================================================== @@ -422,13 +422,13 @@ void php_swoole_set_global_option(HashTable *vht) { sw_logger()->set_date_format(zend::String(ztmp).val()); } if (php_swoole_array_get_value(vht, "log_date_with_microseconds", ztmp)) { - sw_logger()->set_date_with_microseconds(zval_is_true(ztmp)); + sw_logger()->set_date_with_microseconds(zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "log_rotation", ztmp)) { sw_logger()->set_rotation(zval_get_long(ztmp)); } if (php_swoole_array_get_value(vht, "display_errors", ztmp)) { - SWOOLE_G(display_errors) = zval_is_true(ztmp); + SWOOLE_G(display_errors) = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "print_backtrace_on_error", ztmp)) { #if !defined(HAVE_BOOST_STACKTRACE) && !defined(HAVE_EXECINFO) @@ -437,7 +437,7 @@ void php_swoole_set_global_option(HashTable *vht) { "The `print_backtrace_on_error` option requires `boost stacktrace` or `execinfo.h` to be installed", SW_ERROR_OPERATION_NOT_SUPPORT); #else - SwooleG.print_backtrace_on_error = zval_is_true(ztmp); + SwooleG.print_backtrace_on_error = zend_is_true(ztmp); #endif } // [DNS] diff --git a/ext-src/php_swoole_cxx.cc b/ext-src/php_swoole_cxx.cc index cbb59700463..b1df005f425 100644 --- a/ext-src/php_swoole_cxx.cc +++ b/ext-src/php_swoole_cxx.cc @@ -124,7 +124,7 @@ Variable call(const std::string &func_name, int argc, zval *argv) { if (call_user_function(EG(function_table), nullptr, &function_name, &retval.value, argc, argv) != SUCCESS) { ZVAL_NULL(&retval.value); } - zval_dtor(&function_name); + zval_ptr_dtor_nogc(&function_name); /* we have no chance to return to ZendVM to check the exception */ if (UNEXPECTED(EG(exception))) { zend_exception_error(EG(exception), E_ERROR); @@ -136,7 +136,7 @@ Variable call(const std::string &func_name, int argc, zval *argv) { Callable::Callable(zval *_zfn) { ZVAL_UNDEF(&zfn); - if (!zval_is_true(_zfn)) { + if (!zend_is_true(_zfn)) { php_swoole_fatal_error(E_WARNING, "illegal callback function"); return; } diff --git a/ext-src/php_swoole_cxx.h b/ext-src/php_swoole_cxx.h index 32b8a0fceae..62f4549cdf0 100644 --- a/ext-src/php_swoole_cxx.h +++ b/ext-src/php_swoole_cxx.h @@ -838,7 +838,7 @@ static inline zend::Callable *sw_callable_create(zval *zfn) { } static inline zend::Callable *sw_callable_create_ex(zval *zfn, const char *fname, bool allow_null = true) { - if (zfn == nullptr || ZVAL_IS_NULL(zfn)) { + if (zfn == nullptr || Z_ISNULL_P(zfn)) { if (!allow_null) { zend_throw_exception_ex( swoole_exception_ce, SW_ERROR_INVALID_PARAMS, "%s must be of type callable, null given", fname); diff --git a/ext-src/php_swoole_http.h b/ext-src/php_swoole_http.h index a3dff829812..7f1bd0c12b7 100644 --- a/ext-src/php_swoole_http.h +++ b/ext-src/php_swoole_http.h @@ -250,7 +250,7 @@ struct Context { } bool is_co_socket() const { - return !ZVAL_IS_NULL(&zsocket); + return !Z_ISNULL_P(&zsocket); } Server *get_async_server() const { diff --git a/ext-src/php_swoole_private.h b/ext-src/php_swoole_private.h index 5b5f1d23c2a..64f8bca47d4 100644 --- a/ext-src/php_swoole_private.h +++ b/ext-src/php_swoole_private.h @@ -117,8 +117,8 @@ BEGIN_EXTERN_C() #if PHP_VERSION_ID < 80200 #error "require PHP version 8.2 or later" -#elif PHP_VERSION_ID >= 80600 -#error "require PHP version 8.5 or earlier" +#elif PHP_VERSION_ID > 80600 +#error "require PHP version 8.6 or earlier" #endif #if defined(ZTS) && defined(SW_USE_THREAD_CONTEXT) @@ -547,8 +547,8 @@ static sw_inline zend_string *sw_zend_string_recycle(zend_string *s, size_t allo //----------------------------------Array API------------------------------------ #define php_swoole_array_length(zarray) zend_hash_num_elements(Z_ARRVAL_P(zarray)) -#define php_swoole_array_get_value(ht, str, v) ((v = zend_hash_str_find(ht, str, sizeof(str) - 1)) && !ZVAL_IS_NULL(v)) -#define php_swoole_array_get_value_ex(ht, str, v) ((v = zend_hash_str_find(ht, str, strlen(str))) && !ZVAL_IS_NULL(v)) +#define php_swoole_array_get_value(ht, str, v) ((v = zend_hash_str_find(ht, str, sizeof(str) - 1)) && !Z_ISNULL_P(v)) +#define php_swoole_array_get_value_ex(ht, str, v) ((v = zend_hash_str_find(ht, str, strlen(str))) && !Z_ISNULL_P(v)) static sw_inline int php_swoole_array_length_safe(zval *zarray) { if (zarray && ZVAL_IS_ARRAY(zarray)) { diff --git a/ext-src/swoole_async_coro.cc b/ext-src/swoole_async_coro.cc index 53216f00770..4593b38cc66 100644 --- a/ext-src/swoole_async_coro.cc +++ b/ext-src/swoole_async_coro.cc @@ -95,7 +95,7 @@ PHP_FUNCTION(swoole_async_set) { php_swoole_set_aio_option(vht); if (php_swoole_array_get_value(vht, "wait_signal", ztmp)) { - SwooleG.wait_signal = zval_is_true(ztmp); + SwooleG.wait_signal = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "dns_cache_refresh_time", ztmp)) { SwooleG.dns_cache_refresh_time = zval_get_double(ztmp); @@ -112,13 +112,13 @@ PHP_FUNCTION(swoole_async_set) { SwooleG.aio_worker_num = v; } if (php_swoole_array_get_value(vht, "dns_lookup_random", ztmp)) { - SwooleG.dns_lookup_random = zval_is_true(ztmp); + SwooleG.dns_lookup_random = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "use_async_resolver", ztmp)) { - SwooleG.use_async_resolver = zval_is_true(ztmp); + SwooleG.use_async_resolver = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "enable_coroutine", ztmp)) { - SwooleG.enable_coroutine = zval_is_true(ztmp); + SwooleG.enable_coroutine = zend_is_true(ztmp); } RETURN_TRUE; } diff --git a/ext-src/swoole_client.cc b/ext-src/swoole_client.cc index f861adb0572..5ba4dc41ce9 100644 --- a/ext-src/swoole_client.cc +++ b/ext-src/swoole_client.cc @@ -192,7 +192,7 @@ void php_swoole_client_check_ssl_setting(const Client *cli, const zval *zset) { cli->set_ssl_protocols(zval_get_long(ztmp)); } if (php_swoole_array_get_value(vht, "ssl_compress", ztmp)) { - cli->set_ssl_disable_compress(!zval_is_true(ztmp)); + cli->set_ssl_disable_compress(!zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "ssl_cert_file", ztmp)) { zend::String str_v(ztmp); @@ -219,10 +219,10 @@ void php_swoole_client_check_ssl_setting(const Client *cli, const zval *zset) { } #endif if (php_swoole_array_get_value(vht, "ssl_verify_peer", ztmp)) { - cli->set_ssl_verify_peer(zval_is_true(ztmp)); + cli->set_ssl_verify_peer(zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "ssl_allow_self_signed", ztmp)) { - cli->set_ssl_allow_self_signed(zval_is_true(ztmp)); + cli->set_ssl_allow_self_signed(zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "ssl_cafile", ztmp)) { zend::String str_v(ztmp); @@ -257,11 +257,11 @@ bool php_swoole_client_check_setting(Client *cli, const zval *zset) { // buffer: eof check if (php_swoole_array_get_value(vht, "open_eof_check", ztmp)) { - cli->open_eof_check = zval_is_true(ztmp); + cli->open_eof_check = zend_is_true(ztmp); } // buffer: split package with eof if (php_swoole_array_get_value(vht, "open_eof_split", ztmp)) { - cli->protocol.split_by_eof = zval_is_true(ztmp); + cli->protocol.split_by_eof = zend_is_true(ztmp); if (cli->protocol.split_by_eof) { cli->open_eof_check = true; } @@ -281,14 +281,14 @@ bool php_swoole_client_check_setting(Client *cli, const zval *zset) { } // open mqtt protocol if (php_swoole_array_get_value(vht, "open_mqtt_protocol", ztmp)) { - cli->open_length_check = zval_is_true(ztmp); - if (zval_is_true(ztmp)) { + cli->open_length_check = zend_is_true(ztmp); + if (zend_is_true(ztmp)) { swoole::mqtt::set_protocol(&cli->protocol); } } // open length check if (php_swoole_array_get_value(vht, "open_length_check", ztmp)) { - cli->open_length_check = zval_is_true(ztmp); + cli->open_length_check = zend_is_true(ztmp); cli->protocol.get_package_length = Protocol::default_length_func; } // package length size @@ -379,7 +379,7 @@ bool php_swoole_client_check_setting(Client *cli, const zval *zset) { * client: tcp_nodelay */ if (php_swoole_array_get_value(vht, "open_tcp_nodelay", ztmp)) { - if (zval_is_true(ztmp)) { + if (zend_is_true(ztmp)) { goto _open_tcp_nodelay; } } else { @@ -499,7 +499,7 @@ ssize_t php_swoole_length_func(const Protocol *protocol, Socket *_socket, Packet static Client *php_swoole_client_new(zval *zobject, char *host, int host_len, int port) { zval *ztype = sw_zend_read_property_ex(Z_OBJCE_P(zobject), zobject, SW_ZSTR_KNOWN(SW_ZEND_STR_TYPE), 0); - if (ztype == nullptr || ZVAL_IS_NULL(ztype)) { + if (ztype == nullptr || Z_ISNULL_P(ztype)) { php_swoole_fatal_error(E_ERROR, "failed to get swoole_client->type"); return nullptr; } diff --git a/ext-src/swoole_client_async.cc b/ext-src/swoole_client_async.cc index 2593ab9f3e5..9b652b8b619 100644 --- a/ext-src/swoole_client_async.cc +++ b/ext-src/swoole_client_async.cc @@ -255,7 +255,7 @@ static PHP_METHOD(swoole_client_async, __destruct) { static Client *php_swoole_client_async_new(zval *zobject, char *host, int host_len, int port) { zval *ztype = sw_zend_read_property_ex(Z_OBJCE_P(zobject), zobject, SW_ZSTR_KNOWN(SW_ZEND_STR_TYPE), 0); - if (ztype == nullptr || ZVAL_IS_NULL(ztype)) { + if (ztype == nullptr || Z_ISNULL_P(ztype)) { php_swoole_fatal_error(E_ERROR, "failed to get client type"); return nullptr; } diff --git a/ext-src/swoole_coroutine.cc b/ext-src/swoole_coroutine.cc index 2fa34eb2507..700eb5f678b 100644 --- a/ext-src/swoole_coroutine.cc +++ b/ext-src/swoole_coroutine.cc @@ -406,7 +406,7 @@ void PHPCoroutine::activate() { } zval *enable_library = zend_get_constant_str(ZEND_STRL("SWOOLE_LIBRARY")); - if (enable_library == nullptr || !zval_is_true(enable_library)) { + if (enable_library == nullptr || !zend_is_true(enable_library)) { php_swoole_load_library(); } diff --git a/ext-src/swoole_coroutine_scheduler.cc b/ext-src/swoole_coroutine_scheduler.cc index dd079c08393..8cef7263d2a 100644 --- a/ext-src/swoole_coroutine_scheduler.cc +++ b/ext-src/swoole_coroutine_scheduler.cc @@ -126,7 +126,7 @@ static bool php_swoole_coroutine_reactor_can_exit(Reactor *reactor, size_t &even void php_swoole_coroutine_scheduler_rshutdown() { swoole_name_resolver_each([](const std::list::iterator &iter) -> swTraverseOperation { if (iter->type == NameResolver::TYPE_PHP) { - zval_dtor((zval *) iter->private_data); + zval_ptr_dtor_nogc((zval *) iter->private_data); efree(iter->private_data); return SW_TRAVERSE_REMOVE; } else { @@ -148,13 +148,13 @@ void php_swoole_set_coroutine_option(zend_array *vht) { PHPCoroutine::set_max_num(max_num <= 0 ? SW_DEFAULT_MAX_CORO_NUM : max_num); } if (php_swoole_array_get_value(vht, "enable_deadlock_check", ztmp)) { - PHPCoroutine::set_deadlock_check(zval_is_true(ztmp)); + PHPCoroutine::set_deadlock_check(zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "hook_flags", ztmp)) { PHPCoroutine::set_hook_flags(zval_get_long(ztmp)); } if (php_swoole_array_get_value(vht, "enable_preemptive_scheduler", ztmp)) { - PHPCoroutine::enable_preemptive_scheduler(zval_is_true(ztmp)); + PHPCoroutine::enable_preemptive_scheduler(zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "c_stack_size", ztmp) || php_swoole_array_get_value(vht, "stack_size", ztmp)) { Coroutine::set_stack_size(php_swoole_parse_to_size(ztmp)); diff --git a/ext-src/swoole_event.cc b/ext-src/swoole_event.cc index 0892ebadf7c..983a8e4f071 100644 --- a/ext-src/swoole_event.cc +++ b/ext-src/swoole_event.cc @@ -629,7 +629,7 @@ static PHP_FUNCTION(swoole_event_cycle) { auto reactor = sw_reactor(); auto defer_task = before ? &reactor->future_task : &reactor->idle_task; - if (ZVAL_IS_NULL(zcallback)) { + if (Z_ISNULL_P(zcallback)) { if (defer_task->callback == nullptr) { RETURN_FALSE; } else { diff --git a/ext-src/swoole_http2_client_coro.cc b/ext-src/swoole_http2_client_coro.cc index 27df796477c..d875dac0720 100644 --- a/ext-src/swoole_http2_client_coro.cc +++ b/ext-src/swoole_http2_client_coro.cc @@ -980,7 +980,7 @@ ssize_t Client::build_header(const zval *zobj, zval *zrequest, char *buffer) { zval *zvalue; ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(zheaders), key, zvalue) { - if (UNEXPECTED(!key || *ZSTR_VAL(key) == ':' || ZVAL_IS_NULL(zvalue))) { + if (UNEXPECTED(!key || *ZSTR_VAL(key) == ':' || Z_ISNULL_P(zvalue))) { continue; } zend::String str_value(zvalue); @@ -1012,7 +1012,7 @@ ssize_t Client::build_header(const zval *zobj, zval *zrequest, char *buffer) { String *header_buffer = sw_tg_buffer(); ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(zcookies), key, zvalue) { - if (UNEXPECTED(!key || ZVAL_IS_NULL(zvalue))) { + if (UNEXPECTED(!key || Z_ISNULL_P(zvalue))) { continue; } zend::String str_value(zvalue); @@ -1122,7 +1122,7 @@ uint32_t Client::send_request(zval *zrequest) { zval ztmp, *zuse_pipeline_read = zend_read_property_ex( Z_OBJCE_P(zrequest), SW_Z8_OBJ_P(zrequest), SW_ZSTR_KNOWN(SW_ZEND_STR_USE_PIPELINE_READ), true, &ztmp); - bool is_data_empty = Z_TYPE_P(zdata) == IS_STRING ? Z_STRLEN_P(zdata) == 0 : !zval_is_true(zdata); + bool is_data_empty = Z_TYPE_P(zdata) == IS_STRING ? Z_STRLEN_P(zdata) == 0 : !zend_is_true(zdata); if (ZVAL_IS_ARRAY(zdata)) { add_assoc_stringl_ex( @@ -1140,10 +1140,10 @@ uint32_t Client::send_request(zval *zrequest) { } uint8_t flags = 0; - if (zval_is_true(zpipeline)) { + if (zend_is_true(zpipeline)) { flags |= SW_HTTP2_STREAM_PIPELINE_REQUEST; } - if (zval_is_true(zuse_pipeline_read)) { + if (zend_is_true(zuse_pipeline_read)) { flags |= SW_HTTP2_STREAM_USE_PIPELINE_READ; } diff --git a/ext-src/swoole_http2_server.cc b/ext-src/swoole_http2_server.cc index 6c07e55b5c6..2051d6e291a 100644 --- a/ext-src/swoole_http2_server.cc +++ b/ext-src/swoole_http2_server.cc @@ -145,7 +145,7 @@ static ssize_t http2_server_build_trailer(const HttpContext *ctx, uchar *buffer) zval *zvalue; ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(ztrailer), key, zvalue) { - if (UNEXPECTED(!key || ZVAL_IS_NULL(zvalue))) { + if (UNEXPECTED(!key || Z_ISNULL_P(zvalue))) { continue; } zend::String str_value(zvalue); @@ -346,7 +346,7 @@ static ssize_t http2_server_build_header(HttpContext *ctx, uchar *buffer, const auto add_header = [ctx, &content_type]( Http2::HeaderSet &headers, const char *key, size_t l_key, zval *value, uint32_t &header_flags) { - if (ZVAL_IS_NULL(value)) { + if (Z_ISNULL_P(value)) { return; } zend::String str_value(value); @@ -372,7 +372,7 @@ static ssize_t http2_server_build_header(HttpContext *ctx, uchar *buffer, const }; SW_HASHTABLE_FOREACH_START2(Z_ARRVAL_P(zheader), key, keylen, type, zvalue) { - if (UNEXPECTED(!key || ZVAL_IS_NULL(zvalue))) { + if (UNEXPECTED(!key || Z_ISNULL_P(zvalue))) { continue; } if (ZVAL_IS_ARRAY(zvalue)) { diff --git a/ext-src/swoole_http_client_coro.cc b/ext-src/swoole_http_client_coro.cc index b50e860e36f..f8544e7af85 100644 --- a/ext-src/swoole_http_client_coro.cc +++ b/ext-src/swoole_http_client_coro.cc @@ -743,19 +743,19 @@ void Client::apply_setting(zval *zset, const bool check_all) { max_retries = (uint8_t) SW_MIN(zval_get_long(ztmp), UINT8_MAX); } if (php_swoole_array_get_value(vht, "defer", ztmp)) { - defer = zval_is_true(ztmp); + defer = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "lowercase_header", ztmp)) { - lowercase_header = zval_is_true(ztmp); + lowercase_header = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "keep_alive", ztmp)) { - keep_alive = zval_is_true(ztmp); + keep_alive = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "http_compression", ztmp)) { - http_compression = zval_is_true(ztmp); + http_compression = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "body_decompression", ztmp)) { - body_decompression = zval_is_true(ztmp); + body_decompression = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "write_func", ztmp)) { delete write_func; @@ -1004,7 +1004,7 @@ bool Client::send_request() { if (ZVAL_IS_ARRAY(zheaders)) { SW_HASHTABLE_FOREACH_START2(Z_ARRVAL_P(zheaders), key, keylen, keytype, zvalue) { - if (UNEXPECTED(HASH_KEY_IS_STRING != keytype || ZVAL_IS_NULL(zvalue))) { + if (UNEXPECTED(HASH_KEY_IS_STRING != keytype || Z_ISNULL_P(zvalue))) { continue; } if (SW_STRCASEEQ(key, keylen, "Host")) { @@ -1131,7 +1131,7 @@ bool Client::send_request() { // calculate length before encode array if (zbody && ZVAL_IS_ARRAY(zbody)) { SW_HASHTABLE_FOREACH_START2(Z_ARRVAL_P(zbody), key, keylen, keytype, zvalue) - if (UNEXPECTED(HASH_KEY_IS_STRING != keytype || ZVAL_IS_NULL(zvalue))) { + if (UNEXPECTED(HASH_KEY_IS_STRING != keytype || Z_ISNULL_P(zvalue))) { continue; } zend::String str_value(zvalue); @@ -1181,7 +1181,7 @@ bool Client::send_request() { // ============ form-data body ============ if (zbody && ZVAL_IS_ARRAY(zbody)) { SW_HASHTABLE_FOREACH_START2(Z_ARRVAL_P(zbody), key, keylen, keytype, zvalue) { - if (UNEXPECTED(HASH_KEY_IS_STRING != keytype || ZVAL_IS_NULL(zvalue))) { + if (UNEXPECTED(HASH_KEY_IS_STRING != keytype || Z_ISNULL_P(zvalue))) { continue; } zend::String str_value(zvalue); @@ -1499,7 +1499,7 @@ void Client::recv_websocket_frame(zval *return_value, double timeout) { } return; } - if (sw_unlikely(ZVAL_IS_NULL(return_value))) { + if (sw_unlikely(Z_ISNULL_P(return_value))) { ZVAL_FALSE(return_value); } } diff --git a/ext-src/swoole_http_request.cc b/ext-src/swoole_http_request.cc index 80e62a34b18..372e5c96542 100644 --- a/ext-src/swoole_http_request.cc +++ b/ext-src/swoole_http_request.cc @@ -962,22 +962,22 @@ static PHP_METHOD(swoole_http_request, create) { SW_HASHTABLE_FOREACH_START2(Z_ARRVAL_P(zoptions), key, keylen, keytype, zvalue) { if (SW_STRCASEEQ(key, keylen, "parse_cookie")) { - ctx->parse_cookie = zval_is_true(zvalue); + ctx->parse_cookie = zend_is_true(zvalue); } else if (SW_STRCASEEQ(key, keylen, "parse_body")) { - ctx->parse_body = zval_is_true(zvalue); + ctx->parse_body = zend_is_true(zvalue); } else if (SW_STRCASEEQ(key, keylen, "parse_files")) { - ctx->parse_files = zval_is_true(zvalue); + ctx->parse_files = zend_is_true(zvalue); } #ifdef SW_HAVE_COMPRESSION else if (SW_STRCASEEQ(key, keylen, "enable_compression")) { - ctx->enable_compression = zval_is_true(zvalue); + ctx->enable_compression = zend_is_true(zvalue); } else if (SW_STRCASEEQ(key, keylen, "compression_level")) { ctx->compression_level = zval_get_long(zvalue); } #endif #ifdef SW_HAVE_ZLIB else if (SW_STRCASEEQ(key, keylen, "websocket_compression")) { - ctx->websocket_compression = zval_is_true(zvalue); + ctx->websocket_compression = zend_is_true(zvalue); } #endif else if (SW_STRCASEEQ(key, keylen, "upload_tmp_dir")) { @@ -1019,7 +1019,7 @@ static PHP_METHOD(swoole_http_request, parse) { memcpy(new_str->val + Z_STRLEN(ctx->request.zdata), str, l_str); new_str->val[len] = 0; new_str->len = len; - zval_dtor(&ctx->request.zdata); + zval_ptr_dtor_nogc(&ctx->request.zdata); ZVAL_STR(&ctx->request.zdata, new_str); } diff --git a/ext-src/swoole_http_response.cc b/ext-src/swoole_http_response.cc index e929eae409c..3359dc31f79 100644 --- a/ext-src/swoole_http_response.cc +++ b/ext-src/swoole_http_response.cc @@ -277,7 +277,7 @@ static void http_response_set_date_header(String *response) { } static void http_response_add_custom_header(String *http_buffer, const char *key, size_t l_key, zval *value) { - if (ZVAL_IS_NULL(value)) { + if (Z_ISNULL_P(value)) { return; } @@ -472,11 +472,11 @@ ssize_t HttpContext::build_trailer(String *http_buffer) const { zval *zvalue; SW_HASHTABLE_FOREACH_START2(Z_ARRVAL_P(ztrailer), key, keylen, type, zvalue) { - if (UNEXPECTED(!key || ZVAL_IS_NULL(zvalue))) { + if (UNEXPECTED(!key || Z_ISNULL_P(zvalue))) { continue; } - if (!ZVAL_IS_NULL(zvalue)) { + if (!Z_ISNULL_P(zvalue)) { zend::String str_value(zvalue); size_t n = sw_snprintf( buf, l_buf, "%.*s: %.*s\r\n", (int) keylen, key, (int) str_value.len(), str_value.val()); @@ -1460,7 +1460,7 @@ static PHP_METHOD(swoole_http_response, recv) { ctx->close(ctx); return; } - if (sw_unlikely(ZVAL_IS_NULL(return_value))) { + if (sw_unlikely(Z_ISNULL_P(return_value))) { ZVAL_FALSE(return_value); } } diff --git a/ext-src/swoole_http_server_coro.cc b/ext-src/swoole_http_server_coro.cc index 9d192a1b717..dfad66a1596 100644 --- a/ext-src/swoole_http_server_coro.cc +++ b/ext-src/swoole_http_server_coro.cc @@ -188,8 +188,8 @@ class HttpServer { swoole_http2_server_session_free(ctx->fd); ctx->detached = 1; - zval_dtor(ctx->request.zobject); - zval_dtor(ctx->response.zobject); + zval_ptr_dtor_nogc(ctx->request.zobject); + zval_ptr_dtor_nogc(ctx->response.zobject); } }; }; // namespace coroutine @@ -425,20 +425,20 @@ static PHP_METHOD(swoole_http_server_coro, start) { zval *ztmp; // parse cookie header if (php_swoole_array_get_value(vht, "http_parse_cookie", ztmp)) { - hs->parse_cookie = zval_is_true(ztmp); + hs->parse_cookie = zend_is_true(ztmp); } // parse x-www-form-urlencoded form data if (php_swoole_array_get_value(vht, "http_parse_post", ztmp)) { - hs->parse_post = zval_is_true(ztmp); + hs->parse_post = zend_is_true(ztmp); } // parse multipart/form-data file uploads if (php_swoole_array_get_value(vht, "http_parse_files", ztmp)) { - hs->parse_files = zval_is_true(ztmp); + hs->parse_files = zend_is_true(ztmp); } #ifdef SW_HAVE_COMPRESSION // http content compression if (php_swoole_array_get_value(vht, "http_compression", ztmp)) { - hs->compression = zval_is_true(ztmp); + hs->compression = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "http_compression_level", ztmp) || php_swoole_array_get_value(vht, "compression_level", ztmp) || @@ -494,7 +494,7 @@ static PHP_METHOD(swoole_http_server_coro, start) { zval zsocket; php_swoole_init_socket_object(&zsocket, conn); long cid = PHPCoroutine::create(&fci_cache, 1, &zsocket, zcallback.ptr()); - zval_dtor(&zsocket); + zval_ptr_dtor_nogc(&zsocket); if (cid < 0) { goto _wait_1s; } @@ -665,8 +665,8 @@ static PHP_METHOD(swoole_http_server_coro, onAccept) { ctx->response.status = SW_HTTP_NOT_FOUND; } - zval_dtor(&args[0]); - zval_dtor(&args[1]); + zval_ptr_dtor_nogc(&args[0]); + zval_ptr_dtor_nogc(&args[1]); ctx = nullptr; if (!hs->running || !keep_alive || php_swoole_socket_is_closed(zconn)) { @@ -682,8 +682,8 @@ static PHP_METHOD(swoole_http_server_coro, onAccept) { } if (ctx) { - zval_dtor(ctx->request.zobject); - zval_dtor(ctx->response.zobject); + zval_ptr_dtor_nogc(ctx->request.zobject); + zval_ptr_dtor_nogc(ctx->response.zobject); } zend_hash_index_del(Z_ARRVAL_P(&hs->zclients), co->get_cid()); } diff --git a/ext-src/swoole_name_resolver.cc b/ext-src/swoole_name_resolver.cc index e959b5edc15..c38e815f518 100644 --- a/ext-src/swoole_name_resolver.cc +++ b/ext-src/swoole_name_resolver.cc @@ -141,7 +141,7 @@ PHP_FUNCTION(swoole_name_resolver_remove) { bool equals = zend_string_equals(hash_2, hash_1); zend_string_release(hash_2); if (iter->type == NameResolver::TYPE_PHP && iter->private_data && equals) { - zval_dtor(zresolver); + zval_ptr_dtor_nogc(zresolver); efree(iter->private_data); found = true; return SW_TRAVERSE_REMOVE; @@ -184,12 +184,12 @@ std::string php_swoole_name_resolver_lookup(const std::string &name, NameResolve zval zname; ZVAL_STRINGL(&zname, name.c_str(), name.length()); zend_call_method_with_1_params(SW_Z8_OBJ_P(zresolver), nullptr, nullptr, "lookup", &retval, &zname); - zval_dtor(&zname); + zval_ptr_dtor_nogc(&zname); if (Z_TYPE(retval) == IS_OBJECT) { ctx->private_data = zcluster_object = (zval *) ecalloc(1, sizeof(zval)); ctx->dtor = [](NameResolver::Context *ctx) { zval *_zcluster_object = (zval *) ctx->private_data; - zval_dtor(_zcluster_object); + zval_ptr_dtor_nogc(_zcluster_object); efree(_zcluster_object); }; *zcluster_object = retval; diff --git a/ext-src/swoole_process.cc b/ext-src/swoole_process.cc index c65100c5121..3f8b7dc236b 100644 --- a/ext-src/swoole_process.cc +++ b/ext-src/swoole_process.cc @@ -937,7 +937,7 @@ static PHP_METHOD(swoole_process, daemon) { int fd = 0; zval *elem; ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(zpipes), elem) { - if (!ZVAL_IS_NULL(elem)) { + if (!Z_ISNULL_P(elem)) { int new_fd = php_swoole_convert_to_fd(elem); if (new_fd >= 0) { if (dup2(new_fd, fd) < 0) { @@ -1097,7 +1097,7 @@ static PHP_METHOD(swoole_process, set) { swoole_fatal_error(SW_ERROR_WRONG_OPERATION, "must call constructor first"); } if (php_swoole_array_get_value(vht, "enable_coroutine", ztmp)) { - po->enable_coroutine = zval_is_true(ztmp); + po->enable_coroutine = zend_is_true(ztmp); } } diff --git a/ext-src/swoole_process_pool.cc b/ext-src/swoole_process_pool.cc index ae5be831f3d..2a29ff50ab8 100644 --- a/ext-src/swoole_process_pool.cc +++ b/ext-src/swoole_process_pool.cc @@ -422,10 +422,10 @@ static PHP_METHOD(swoole_process_pool, set) { php_swoole_set_aio_option(vht); if (php_swoole_array_get_value(vht, "enable_coroutine", ztmp)) { - pool->async = pp->enable_coroutine = zval_is_true(ztmp); + pool->async = pp->enable_coroutine = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "enable_message_bus", ztmp)) { - pp->enable_message_bus = zval_is_true(ztmp); + pp->enable_message_bus = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "max_package_size", ztmp)) { pool->set_max_packet_size(php_swoole_parse_to_size(ztmp)); @@ -679,7 +679,7 @@ static PHP_METHOD(swoole_process_pool, getProcess) { zval *zprocess = zend_hash_index_find(Z_ARRVAL_P(zworkers), worker_id); zval zobject; - if (zprocess == nullptr || ZVAL_IS_NULL(zprocess)) { + if (zprocess == nullptr || Z_ISNULL_P(zprocess)) { zprocess = &zobject; /** * Separation from shared memory diff --git a/ext-src/swoole_runtime.cc b/ext-src/swoole_runtime.cc index 5f4c508045a..3f8e9ee176d 100644 --- a/ext-src/swoole_runtime.cc +++ b/ext-src/swoole_runtime.cc @@ -176,7 +176,7 @@ static php_stream_ops ori_php_stream_stdio_ops; static void hook_func(const char *name, size_t l_name, zif_handler handler = nullptr, - zend_internal_arg_info *arg_info = nullptr); + zend_arg_info *arg_info = nullptr); static void unhook_func(const char *name, size_t l_name); static bool extension_loaded(const char *name) { @@ -197,7 +197,7 @@ static bool class_exists(const char *name) { return !!ce; } -static zend_internal_arg_info *get_arginfo(const char *name, size_t l_name) { +static zend_arg_info *get_arginfo(const char *name, size_t l_name) { auto *zf = zend::get_function(name, l_name); if (zf == nullptr) { return nullptr; @@ -205,12 +205,12 @@ static zend_internal_arg_info *get_arginfo(const char *name, size_t l_name) { return zf->internal_function.arg_info; } -static zend_internal_arg_info *copy_arginfo(const zend_internal_function *function, zend_internal_arg_info *_arg_info) { +static zend_arg_info *copy_arginfo(const zend_internal_function *function, zend_arg_info *_arg_info) { uint32_t num_args = function->num_args + 1; - zend_internal_arg_info *arg_info = _arg_info - 1; + zend_arg_info *arg_info = _arg_info - 1; - auto new_arg_info = static_cast(pemalloc(sizeof(zend_internal_arg_info) * num_args, 1)); - memcpy(new_arg_info, arg_info, sizeof(zend_internal_arg_info) * num_args); + auto new_arg_info = static_cast(pemalloc(sizeof(zend_arg_info) * num_args, 1)); + memcpy(new_arg_info, arg_info, sizeof(zend_arg_info) * num_args); if (function->fn_flags & ZEND_ACC_VARIADIC) { num_args++; @@ -250,8 +250,8 @@ static zend_internal_arg_info *copy_arginfo(const zend_internal_function *functi return new_arg_info + 1; } -static void free_arg_info(const zend_internal_function *function, zend_internal_arg_info *arg_info_copy) { - zend_internal_arg_info *arg_info = arg_info_copy - 1; +static void free_arg_info(const zend_internal_function *function, zend_arg_info *arg_info_copy) { + zend_arg_info *arg_info = arg_info_copy - 1; uint32_t num_args = function->num_args + 1; if (function->fn_flags & ZEND_ACC_VARIADIC) { num_args++; @@ -275,7 +275,7 @@ static int runtime_hook_flags = 0; static zend_array *hook_function_table = nullptr; static std::unordered_map child_class_entries; static zend::ConcurrencyHashMap ori_func_handlers(nullptr); -static zend::ConcurrencyHashMap ori_func_arg_infos(nullptr); +static zend::ConcurrencyHashMap ori_func_arg_infos(nullptr); SW_EXTERN_C_BEGIN #include "ext/standard/file.h" @@ -338,9 +338,9 @@ void php_swoole_runtime_minit(int module_number) { struct PhpFunc { zend_function *function; - zend_internal_arg_info *ori_arg_info; + zend_arg_info *ori_arg_info; zif_handler ori_handler; - zend_internal_arg_info *arg_info_copy; + zend_arg_info *arg_info_copy; uint32_t ori_fn_flags; zend::Callable *fci_cache; zval name; @@ -418,7 +418,7 @@ void php_swoole_runtime_rshutdown() { sw_callable_free(rf->fci_cache); } if (Z_TYPE(rf->name) == IS_STRING) { - zval_dtor(&rf->name); + zval_ptr_dtor_nogc(&rf->name); } if (rf->arg_info_copy) { free_arg_info(&rf->function->internal_function, rf->arg_info_copy); @@ -732,7 +732,7 @@ static inline int socket_accept(php_stream *stream, SocketImpl *sock, php_stream if ((nullptr != PHP_STREAM_CONTEXT(stream)) && (tmpzval = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "socket", "tcp_nodelay")) != nullptr && - zval_is_true(tmpzval)) { + zend_is_true(tmpzval)) { tcp_nodelay = 1; } @@ -879,7 +879,7 @@ static bool php_openssl_capture_peer_certs(php_stream *stream, SocketImpl *sslso ZVAL_STRINGL(&argv[0], peer_cert.c_str(), peer_cert.length()); auto retval = zend::function::call("openssl_x509_read", 1, argv); php_stream_context_set_option(PHP_STREAM_CONTEXT(stream), "ssl", "peer_certificate", &retval.value); - zval_dtor(&argv[0]); + zval_ptr_dtor_nogc(&argv[0]); if (nullptr != (val = php_stream_context_get_option(PHP_STREAM_CONTEXT(stream), "ssl", "capture_peer_cert_chain")) && @@ -895,7 +895,7 @@ static bool php_openssl_capture_peer_certs(php_stream *stream, SocketImpl *sslso auto _retval = zend::function::call("openssl_x509_read", 1, _argv); zval_add_ref(&_retval.value); add_next_index_zval(&arr, &_retval.value); - zval_dtor(&_argv[0]); + zval_ptr_dtor_nogc(&_argv[0]); } } else { ZVAL_NULL(&arr); @@ -964,21 +964,21 @@ static inline int socket_xport_api(php_stream *stream, SocketImpl *sock, php_str #ifdef IPV6_V6ONLY if ((tmpzval = php_stream_context_get_option(ctx, "socket", "ipv6_v6only")) != nullptr && - zval_is_true(tmpzval)) { + zend_is_true(tmpzval)) { sock->get_socket()->set_option(IPPROTO_IPV6, IPV6_V6ONLY, 1); } #endif #ifdef SO_REUSEPORT if ((tmpzval = php_stream_context_get_option(ctx, "socket", "so_reuseport")) != nullptr && - zval_is_true(tmpzval)) { + zend_is_true(tmpzval)) { sock->get_socket()->set_reuse_port(); } #endif #ifdef SO_BROADCAST if ((tmpzval = php_stream_context_get_option(ctx, "socket", "so_broadcast")) != nullptr && - zval_is_true(tmpzval)) { + zend_is_true(tmpzval)) { sock->set_option(SOL_SOCKET, SO_BROADCAST, 1); } #endif @@ -1179,7 +1179,7 @@ static bool socket_ssl_set_options(SocketImpl *sock, php_stream_context *context add_alias("disable_compression", "ssl_disable_compression"); bool ret = php_swoole_socket_set_ssl(sock, &zalias); - zval_dtor(&zalias); + zval_ptr_dtor_nogc(&zalias); return ret; } } @@ -2146,7 +2146,7 @@ static PHP_FUNCTION(swoole_stream_select) { RETURN_LONG(retval); } -static void hook_func(const char *name, size_t l_name, zif_handler handler, zend_internal_arg_info *arg_info) { +static void hook_func(const char *name, size_t l_name, zif_handler handler, zend_arg_info *arg_info) { auto *rf = static_cast(zend_hash_str_find_ptr(hook_function_table, name, l_name)); bool use_php_func = false; /** diff --git a/ext-src/swoole_server.cc b/ext-src/swoole_server.cc index b86a0b5655f..70cbe712b92 100644 --- a/ext-src/swoole_server.cc +++ b/ext-src/swoole_server.cc @@ -938,7 +938,7 @@ void ServerObject::on_before_start() { zval *zport_setting = sw_zend_read_property_ex(swoole_server_port_ce, zport, SW_ZSTR_KNOWN(SW_ZEND_STR_SETTING), 0); // use swoole_server->setting - if (zport_setting == nullptr || ZVAL_IS_NULL(zport_setting)) { + if (zport_setting == nullptr || Z_ISNULL_P(zport_setting)) { Z_TRY_ADDREF_P(zport); sw_zend_call_method_with_1_params(zport, swoole_server_port_ce, nullptr, "set", nullptr, zsetting); } @@ -1314,7 +1314,7 @@ static int php_swoole_server_onTask(Server *serv, EventData *req) { zval_ptr_dtor(&argv[1]); } - if (!ZVAL_IS_NULL(&retval)) { + if (!Z_ISNULL_P(&retval)) { php_swoole_server_task_finish(serv, &retval, req); zval_ptr_dtor(&retval); } @@ -1835,7 +1835,7 @@ static int php_swoole_server_dispatch_func(Server *serv, Connection *conn, SendD HOOK_PHP_CALL_STACK(auto call_result = sw_zend_call_function_ex(nullptr, cb->ptr(), zdata ? 4 : 3, args, &retval);); if (UNEXPECTED(call_result != SUCCESS)) { php_swoole_error(E_WARNING, "%s->onDispatch handler error", SW_Z_OBJCE_NAME_VAL_P(zserv)); - } else if (!ZVAL_IS_NULL(&retval)) { + } else if (!Z_ISNULL_P(&retval)) { worker_id = zval_get_long(&retval); if (worker_id >= (zend_long) serv->worker_num) { php_swoole_fatal_error(E_WARNING, "invalid target worker-id[" ZEND_LONG_FMT "]", worker_id); @@ -2043,7 +2043,7 @@ static PHP_METHOD(swoole_server, set) { serv->group_ = zend::String(ztmp).to_std_string(); } if (php_swoole_array_get_value(vht, "daemonize", ztmp)) { - serv->daemonize = zval_is_true(ztmp); + serv->daemonize = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "pid_file", ztmp)) { serv->pid_file = zend::String(ztmp).to_std_string(); @@ -2056,7 +2056,7 @@ static PHP_METHOD(swoole_server, set) { } } if (php_swoole_array_get_value(vht, "single_thread", ztmp)) { - serv->single_thread = zval_is_true(ztmp); + serv->single_thread = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "worker_num", ztmp)) { zend_long v = zval_get_long(ztmp); @@ -2085,7 +2085,7 @@ static PHP_METHOD(swoole_server, set) { serv->set_worker_max_concurrency(SW_MAX(1, SW_MIN(v, UINT32_MAX))); } if (php_swoole_array_get_value(vht, "enable_coroutine", ztmp)) { - serv->enable_coroutine = zval_is_true(ztmp); + serv->enable_coroutine = zend_is_true(ztmp); } else { serv->enable_coroutine = SwooleG.enable_coroutine; } @@ -2097,7 +2097,7 @@ static PHP_METHOD(swoole_server, set) { serv->dispatch_mode = SW_MAX(0, SW_MIN(v, UINT8_MAX)); } if (php_swoole_array_get_value(vht, "send_yield", ztmp)) { - serv->send_yield = zval_is_true(ztmp); + serv->send_yield = zend_is_true(ztmp); if (serv->send_yield && !(serv->dispatch_mode == Server::DISPATCH_FDMOD || serv->dispatch_mode == Server::DISPATCH_IPMOD)) { php_swoole_error(E_WARNING, "'send_yield' option can only be set when using dispatch_mode=2/4"); @@ -2121,35 +2121,35 @@ static PHP_METHOD(swoole_server, set) { * for dispatch_mode = 1/3 */ if (php_swoole_array_get_value(vht, "discard_timeout_request", ztmp)) { - serv->discard_timeout_request = zval_is_true(ztmp); + serv->discard_timeout_request = zend_is_true(ztmp); } // onConnect/onClose event if (php_swoole_array_get_value(vht, "enable_unsafe_event", ztmp)) { - serv->enable_unsafe_event = zval_is_true(ztmp); + serv->enable_unsafe_event = zend_is_true(ztmp); } // delay receive if (php_swoole_array_get_value(vht, "enable_delay_receive", ztmp)) { - serv->enable_delay_receive = zval_is_true(ztmp); + serv->enable_delay_receive = zend_is_true(ztmp); } #if defined(__linux__) and defined(HAVE_REUSEPORT) if (php_swoole_array_get_value(vht, "enable_reuse_port", ztmp)) { - serv->enable_reuse_port = zval_is_true(ztmp); + serv->enable_reuse_port = zend_is_true(ztmp); } #endif // task use object if (php_swoole_array_get_value(vht, "task_use_object", ztmp) || php_swoole_array_get_value(vht, "task_object", ztmp)) { - serv->task_object = zval_is_true(ztmp); + serv->task_object = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "event_object", ztmp)) { - serv->event_object = zval_is_true(ztmp); + serv->event_object = zend_is_true(ztmp); if (serv->event_object) { serv->task_object = true; } } // task coroutine if (php_swoole_array_get_value(vht, "task_enable_coroutine", ztmp)) { - serv->task_enable_coroutine = zval_is_true(ztmp); + serv->task_enable_coroutine = zend_is_true(ztmp); } // task_worker_num if (php_swoole_array_get_value(vht, "task_worker_num", ztmp)) { @@ -2210,11 +2210,11 @@ static PHP_METHOD(swoole_server, set) { } // reload async if (php_swoole_array_get_value(vht, "reload_async", ztmp)) { - serv->reload_async = zval_is_true(ztmp); + serv->reload_async = zend_is_true(ztmp); } // cpu affinity if (php_swoole_array_get_value(vht, "open_cpu_affinity", ztmp)) { - serv->open_cpu_affinity = zval_is_true(ztmp); + serv->open_cpu_affinity = zend_is_true(ztmp); } // cpu affinity set if (php_swoole_array_get_value(vht, "cpu_affinity_ignore", ztmp)) { @@ -2253,20 +2253,20 @@ static PHP_METHOD(swoole_server, set) { } // parse cookie header if (php_swoole_array_get_value(vht, "http_parse_cookie", ztmp)) { - serv->http_parse_cookie = zval_is_true(ztmp); + serv->http_parse_cookie = zend_is_true(ztmp); } // parse x-www-form-urlencoded form data if (php_swoole_array_get_value(vht, "http_parse_post", ztmp)) { - serv->http_parse_post = zval_is_true(ztmp); + serv->http_parse_post = zend_is_true(ztmp); } // parse multipart/form-data file uploads if (php_swoole_array_get_value(vht, "http_parse_files", ztmp)) { - serv->http_parse_files = zval_is_true(ztmp); + serv->http_parse_files = zend_is_true(ztmp); } #ifdef SW_HAVE_COMPRESSION // http content compression if (php_swoole_array_get_value(vht, "http_compression", ztmp)) { - serv->http_compression = zval_is_true(ztmp); + serv->http_compression = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "http_compression_level", ztmp) || php_swoole_array_get_value(vht, "compression_level", ztmp) || @@ -2287,7 +2287,7 @@ static PHP_METHOD(swoole_server, set) { #ifdef SW_HAVE_ZLIB if (php_swoole_array_get_value(vht, "websocket_compression", ztmp)) { - serv->websocket_compression = zval_is_true(ztmp); + serv->websocket_compression = zend_is_true(ztmp); } #endif @@ -2307,7 +2307,7 @@ static PHP_METHOD(swoole_server, set) { * http static file handler */ if (php_swoole_array_get_value(vht, "enable_static_handler", ztmp)) { - serv->enable_static_handler = zval_is_true(ztmp); + serv->enable_static_handler = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "document_root", ztmp)) { zend::String str_v(ztmp); @@ -2318,7 +2318,7 @@ static PHP_METHOD(swoole_server, set) { serv->set_document_root(std::string(str_v.val(), str_v.len())); } if (php_swoole_array_get_value(vht, "http_autoindex", ztmp)) { - serv->http_autoindex = zval_is_true(ztmp); + serv->http_autoindex = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "http_index_files", ztmp)) { if (ZVAL_IS_ARRAY(ztmp)) { @@ -2511,7 +2511,7 @@ static PHP_METHOD(swoole_server, getCallback) { zval rv, *property = zend_read_property( Z_OBJCE_P(ZEND_THIS), SW_Z8_OBJ_P(ZEND_THIS), property_name.c_str(), property_name.length(), true, &rv); - if (!ZVAL_IS_NULL(property)) { + if (!Z_ISNULL_P(property)) { RETURN_ZVAL(property, 1, 0); } } @@ -2715,7 +2715,7 @@ static PHP_METHOD(swoole_server, start) { zval *_bootstrap = zend::object_get(ZEND_THIS, ZEND_STRL("bootstrap")); bootstrap = zend_string_dup(Z_STR_P(_bootstrap), true); - if (!ZVAL_IS_NULL(&server_object->init_arguments)) { + if (!Z_ISNULL_P(&server_object->init_arguments)) { zval _thread_argv; call_user_function(NULL, nullptr, &server_object->init_arguments, &_thread_argv, 0, nullptr); if (ZVAL_IS_ARRAY(&_thread_argv)) { @@ -2777,7 +2777,7 @@ static PHP_METHOD(swoole_server, send) { Z_PARAM_LONG(server_socket) ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); - if (UNEXPECTED(ZVAL_IS_NULL(zfd))) { + if (UNEXPECTED(Z_ISNULL_P(zfd))) { php_swoole_fatal_error(E_WARNING, "fd can not be null"); RETURN_FALSE; } @@ -3331,7 +3331,7 @@ static PHP_METHOD(swoole_server, task) { if (!serv->is_worker()) { buf.info.ext_flags |= SW_TASK_NOREPLY; - } else if (zfn && zval_is_true(zfn)) { + } else if (zfn && zend_is_true(zfn)) { buf.info.ext_flags |= SW_TASK_CALLBACK; auto cb = sw_callable_create(zfn); if (!cb) { diff --git a/ext-src/swoole_server_port.cc b/ext-src/swoole_server_port.cc index 77e5efe9a05..69352803c6c 100644 --- a/ext-src/swoole_server_port.cc +++ b/ext-src/swoole_server_port.cc @@ -306,7 +306,7 @@ static PHP_METHOD(swoole_server_port, set) { } // server: tcp_nodelay if (php_swoole_array_get_value(vht, "open_tcp_nodelay", ztmp)) { - port->open_tcp_nodelay = zval_is_true(ztmp); + port->open_tcp_nodelay = zend_is_true(ztmp); } else { port->open_tcp_nodelay = true; } @@ -317,15 +317,15 @@ static PHP_METHOD(swoole_server_port, set) { } // tcp_keepalive if (php_swoole_array_get_value(vht, "open_tcp_keepalive", ztmp)) { - port->open_tcp_keepalive = zval_is_true(ztmp); + port->open_tcp_keepalive = zend_is_true(ztmp); } // buffer: eof check if (php_swoole_array_get_value(vht, "open_eof_check", ztmp)) { - port->open_eof_check = zval_is_true(ztmp); + port->open_eof_check = zend_is_true(ztmp); } // buffer: split package with eof if (php_swoole_array_get_value(vht, "open_eof_split", ztmp)) { - port->protocol.split_by_eof = zval_is_true(ztmp); + port->protocol.split_by_eof = zend_is_true(ztmp); if (port->protocol.split_by_eof) { port->open_eof_check = true; } @@ -345,11 +345,11 @@ static PHP_METHOD(swoole_server_port, set) { } // http_protocol if (php_swoole_array_get_value(vht, "open_http_protocol", ztmp)) { - port->open_http_protocol = zval_is_true(ztmp); + port->open_http_protocol = zend_is_true(ztmp); } // websocket protocol if (php_swoole_array_get_value(vht, "open_websocket_protocol", ztmp)) { - port->open_websocket_protocol = zval_is_true(ztmp); + port->open_websocket_protocol = zend_is_true(ztmp); if (port->open_websocket_protocol) { port->open_http_protocol = true; } @@ -358,14 +358,14 @@ static PHP_METHOD(swoole_server_port, set) { php_swoole_server_set_websocket_option(port, vht); // http2 protocol if (php_swoole_array_get_value(vht, "open_http2_protocol", ztmp)) { - port->open_http2_protocol = zval_is_true(ztmp); + port->open_http2_protocol = zend_is_true(ztmp); if (port->open_http2_protocol) { port->open_http_protocol = true; } } // buffer: mqtt protocol if (php_swoole_array_get_value(vht, "open_mqtt_protocol", ztmp)) { - port->open_mqtt_protocol = zval_is_true(ztmp); + port->open_mqtt_protocol = zend_is_true(ztmp); } // redis protocol if (php_swoole_array_get_value(vht, "open_redis_protocol", ztmp)) { @@ -397,11 +397,11 @@ static PHP_METHOD(swoole_server_port, set) { } // tcp_fastopen if (php_swoole_array_get_value(vht, "tcp_fastopen", ztmp)) { - port->tcp_fastopen = zval_is_true(ztmp); + port->tcp_fastopen = zend_is_true(ztmp); } // open length check if (php_swoole_array_get_value(vht, "open_length_check", ztmp)) { - port->open_length_check = zval_is_true(ztmp); + port->open_length_check = zend_is_true(ztmp); } // package length size if (php_swoole_array_get_value(vht, "package_length_type", ztmp)) { @@ -458,16 +458,16 @@ static PHP_METHOD(swoole_server_port, set) { RETURN_FALSE; } if (php_swoole_array_get_value(vht, "ssl_compress", ztmp)) { - port->set_ssl_disable_compress(!zval_is_true(ztmp)); + port->set_ssl_disable_compress(!zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "ssl_protocols", ztmp)) { port->set_ssl_protocols(zval_get_long(ztmp)); } if (php_swoole_array_get_value(vht, "ssl_verify_peer", ztmp)) { - port->set_ssl_verify_peer(zval_is_true(ztmp)); + port->set_ssl_verify_peer(zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "ssl_allow_self_signed", ztmp)) { - port->set_ssl_allow_self_signed(zval_is_true(ztmp)); + port->set_ssl_allow_self_signed(zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "ssl_client_cert_file", ztmp)) { zend::String str_v(ztmp); @@ -489,7 +489,7 @@ static PHP_METHOD(swoole_server_port, set) { port->set_ssl_verify_depth(SW_MAX(0, SW_MIN(v, UINT8_MAX))); } if (php_swoole_array_get_value(vht, "ssl_prefer_server_ciphers", ztmp)) { - port->set_ssl_prefer_server_ciphers(zval_is_true(ztmp)); + port->set_ssl_prefer_server_ciphers(zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "ssl_ciphers", ztmp)) { port->set_ssl_ciphers(zend::String(ztmp).to_std_string()); @@ -630,7 +630,7 @@ static PHP_METHOD(swoole_server_port, getCallback) { property_name.length(), true, &rv); - if (!ZVAL_IS_NULL(property)) { + if (!Z_ISNULL_P(property)) { RETURN_ZVAL(property, 1, 0); } } diff --git a/ext-src/swoole_socket_coro.cc b/ext-src/swoole_socket_coro.cc index fc67afb3a75..24f094198bd 100644 --- a/ext-src/swoole_socket_coro.cc +++ b/ext-src/swoole_socket_coro.cc @@ -874,12 +874,12 @@ SW_API bool php_swoole_socket_set_protocol(SocketImpl *sock, const zval *zset) { * ssl */ if (php_swoole_array_get_value(vht, "open_ssl", ztmp)) { - if (zval_is_true(ztmp)) { + if (zend_is_true(ztmp)) { sock->enable_ssl_encrypt(); } } if (php_swoole_array_get_value(vht, "open_http2_protocol", ztmp)) { - sock->http2 = zval_is_true(ztmp); + sock->http2 = zend_is_true(ztmp); } if (sock->ssl_is_enable()) { if (!php_swoole_socket_set_ssl(sock, zset)) { @@ -891,11 +891,11 @@ SW_API bool php_swoole_socket_set_protocol(SocketImpl *sock, const zval *zset) { */ // buffer: eof check if (php_swoole_array_get_value(vht, "open_eof_check", ztmp)) { - sock->open_eof_check = zval_is_true(ztmp); + sock->open_eof_check = zend_is_true(ztmp); } // buffer: split package with eof if (php_swoole_array_get_value(vht, "open_eof_split", ztmp)) { - sock->protocol.split_by_eof = zval_is_true(ztmp); + sock->protocol.split_by_eof = zend_is_true(ztmp); if (sock->protocol.split_by_eof) { sock->open_eof_check = true; } @@ -917,7 +917,7 @@ SW_API bool php_swoole_socket_set_protocol(SocketImpl *sock, const zval *zset) { if (php_swoole_array_get_value(vht, "open_fastcgi_protocol", ztmp)) { #define FCGI_HEADER_LEN 8 #define FCGI_MAX_LENGTH 0xffff - sock->open_length_check = zval_is_true(ztmp); + sock->open_length_check = zend_is_true(ztmp); sock->protocol.package_length_size = FCGI_HEADER_LEN; sock->protocol.package_length_offset = 0; sock->protocol.package_body_offset = 0; @@ -938,14 +938,14 @@ SW_API bool php_swoole_socket_set_protocol(SocketImpl *sock, const zval *zset) { } // open mqtt protocol if (php_swoole_array_get_value(vht, "open_mqtt_protocol", ztmp)) { - sock->open_length_check = zval_is_true(ztmp); - if (zval_is_true(ztmp)) { + sock->open_length_check = zend_is_true(ztmp); + if (zend_is_true(ztmp)) { swoole::mqtt::set_protocol(&sock->protocol); } } // open length check if (php_swoole_array_get_value(vht, "open_length_check", ztmp)) { - sock->open_length_check = zval_is_true(ztmp); + sock->open_length_check = zend_is_true(ztmp); sock->protocol.get_package_length = Protocol::default_length_func; } // package length size @@ -1047,7 +1047,7 @@ SW_API bool php_swoole_socket_set(SocketImpl *cli, const zval *zset) { */ if (php_swoole_array_get_value(vht, "open_tcp_nodelay", ztmp)) { if (cli->get_type() == SW_SOCK_TCP || cli->get_type() != SW_SOCK_TCP6) { - cli->get_socket()->set_tcp_nodelay(zval_is_true(ztmp)); + cli->get_socket()->set_tcp_nodelay(zend_is_true(ztmp)); } } /** @@ -1127,9 +1127,9 @@ SW_API bool php_swoole_socket_set_ssl(SocketImpl *sock, const zval *zset) { sock->set_ssl_protocols(v); } if (php_swoole_array_get_value(vht, "ssl_compress", ztmp)) { - sock->set_ssl_disable_compress(!zval_is_true(ztmp)); + sock->set_ssl_disable_compress(!zend_is_true(ztmp)); } else if (php_swoole_array_get_value(vht, "ssl_disable_compression", ztmp)) { - sock->set_ssl_disable_compress(!zval_is_true(ztmp)); + sock->set_ssl_disable_compress(!zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "ssl_cert_file", ztmp)) { zend::String str_v(ztmp); @@ -1160,10 +1160,10 @@ SW_API bool php_swoole_socket_set_ssl(SocketImpl *sock, const zval *zset) { } #endif if (php_swoole_array_get_value(vht, "ssl_verify_peer", ztmp)) { - sock->set_ssl_verify_peer(zval_is_true(ztmp)); + sock->set_ssl_verify_peer(zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "ssl_allow_self_signed", ztmp)) { - sock->set_ssl_allow_self_signed(zval_is_true(ztmp)); + sock->set_ssl_allow_self_signed(zend_is_true(ztmp)); } if (php_swoole_array_get_value(vht, "ssl_cafile", ztmp)) { sock->set_ssl_cafile(zend::String(ztmp).to_std_string()); @@ -1754,7 +1754,7 @@ static PHP_METHOD(swoole_socket_coro, recvfrom) { zend_string_free(buf); RETURN_EMPTY_STRING(); } else { - zval_dtor(peername); + zval_ptr_dtor_nogc(peername); array_init(peername); add_assoc_string(peername, "address", (char *) sock->socket->get_addr()); add_assoc_long(peername, "port", sock->socket->get_port()); diff --git a/ext-src/swoole_stdext.cc b/ext-src/swoole_stdext.cc index 63e0a375ad8..e91eca67c09 100644 --- a/ext-src/swoole_stdext.cc +++ b/ext-src/swoole_stdext.cc @@ -648,7 +648,7 @@ static void array_add_or_update(const zend_op *opline, zval *container, const zv HashTable *ht = Z_ARRVAL_P(container); const zend_op *op_data = opline + 1; - if (ZVAL_IS_NULL(key)) { + if (Z_ISNULL_P(key)) { var_ptr = zend_hash_next_index_insert(ht, value); if (UNEXPECTED(!var_ptr)) { zend_cannot_add_element(); diff --git a/ext-src/swoole_table.cc b/ext-src/swoole_table.cc index f0830042787..0476d1827bf 100644 --- a/ext-src/swoole_table.cc +++ b/ext-src/swoole_table.cc @@ -296,7 +296,7 @@ static PHP_METHOD(swoole_table, set) { if (out_flags & SW_TABLE_FLAG_NEW_ROW) { for (const auto col : *table->column_list) { zval *zv = zend_hash_str_find(ht, col->name.c_str(), col->name.length()); - if (zv == nullptr || ZVAL_IS_NULL(zv)) { + if (zv == nullptr || Z_ISNULL_P(zv)) { col->clear(row); } else { if (col->type == TableColumn::TYPE_STRING) { diff --git a/ext-src/swoole_thread.cc b/ext-src/swoole_thread.cc index 26b02a8a759..5367a702bfe 100644 --- a/ext-src/swoole_thread.cc +++ b/ext-src/swoole_thread.cc @@ -352,7 +352,7 @@ void php_swoole_thread_rinit() { } void php_swoole_thread_rshutdown() { - zval_dtor(&thread_argv); + zval_ptr_dtor_nogc(&thread_argv); if (!tsrm_is_main_thread()) { return; } @@ -1039,7 +1039,7 @@ void ZendArray::append(zval *zvalue) { } bool ZendArray::index_incr(zval *zkey, zval *zvalue, zval *return_value) { - zend_long index = ZVAL_IS_NULL(zkey) ? -1 : zval_get_long(zkey); + zend_long index = Z_ISNULL_P(zkey) ? -1 : zval_get_long(zkey); bool success = true; lock_.lock(); diff --git a/ext-src/swoole_thread_arraylist.cc b/ext-src/swoole_thread_arraylist.cc index 0eacd333613..54f800f40a6 100644 --- a/ext-src/swoole_thread_arraylist.cc +++ b/ext-src/swoole_thread_arraylist.cc @@ -175,7 +175,7 @@ static PHP_METHOD(swoole_thread_arraylist, offsetSet) { ZEND_PARSE_PARAMETERS_END(); auto ao = arraylist_fetch_object_check(ZEND_THIS); - zend_long index = ZVAL_IS_NULL(zkey) ? -1 : zval_get_long(zkey); + zend_long index = Z_ISNULL_P(zkey) ? -1 : zval_get_long(zkey); if (!ao->list->index_offsetSet(index, zvalue)) { zend_throw_exception(swoole_exception_ce, "out of range", -1); } diff --git a/ext-src/swoole_websocket_server.cc b/ext-src/swoole_websocket_server.cc index ed29431410c..c8b84509882 100644 --- a/ext-src/swoole_websocket_server.cc +++ b/ext-src/swoole_websocket_server.cc @@ -138,7 +138,7 @@ bool FrameObject::pack(String *buffer) { } zend::String str_zdata; - if (data && !ZVAL_IS_NULL(data)) { + if (data && !Z_ISNULL_P(data)) { str_zdata = data; ptr = str_zdata.val(); len = str_zdata.len(); @@ -207,7 +207,7 @@ FrameObject::FrameObject(zval *zdata, zend_long _opcode, zend_long _flags, zend_ } if ((ztmp = sw_zend_read_property_not_null_ex( swoole_websocket_frame_ce, zdata, SW_ZSTR_KNOWN(SW_ZEND_STR_FINISH), 1))) { - if (zval_is_true(ztmp)) { + if (zend_is_true(ztmp)) { sw_set_bit(flags, WebSocket::FLAG_FIN); } else { sw_unset_bit(flags, WebSocket::FLAG_FIN); @@ -642,23 +642,23 @@ void WebSocket::apply_setting(WebSocketSettings &settings, zend_array *vht, bool settings.protocol = zend::String(ztmp).to_std_string(); } if (php_swoole_array_get_value(vht, "websocket_mask", ztmp)) { - settings.mask = zval_is_true(ztmp); + settings.mask = zend_is_true(ztmp); } else { settings.mask = !in_server; } #ifdef SW_HAVE_ZLIB if (php_swoole_array_get_value(vht, "websocket_compression", ztmp)) { - settings.compression = zval_is_true(ztmp); + settings.compression = zend_is_true(ztmp); } #endif if (php_swoole_array_get_value(vht, "open_websocket_close_frame", ztmp)) { - settings.open_close_frame = zval_is_true(ztmp); + settings.open_close_frame = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "open_websocket_ping_frame", ztmp)) { - settings.open_ping_frame = zval_is_true(ztmp); + settings.open_ping_frame = zend_is_true(ztmp); } if (php_swoole_array_get_value(vht, "open_websocket_pong_frame", ztmp)) { - settings.open_pong_frame = zval_is_true(ztmp); + settings.open_pong_frame = zend_is_true(ztmp); } settings.in_server = in_server; } diff --git a/tests/swoole_curl/basic/22.skip.php b/tests/swoole_curl/basic/22.skip.php new file mode 100644 index 00000000000..97e60522078 --- /dev/null +++ b/tests/swoole_curl/basic/22.skip.php @@ -0,0 +1,2 @@ + diff --git a/thirdparty/pdo_oci/oci_statement.c b/thirdparty/pdo_oci/oci_statement.c index 953cac03fbf..2c3e9d6a565 100644 --- a/thirdparty/pdo_oci/oci_statement.c +++ b/thirdparty/pdo_oci/oci_statement.c @@ -213,7 +213,7 @@ static sb4 oci_bind_input_cb( if (P->thing) { *bufpp = P->thing; *alenp = sizeof(void *); - } else if (ZVAL_IS_NULL(parameter)) { + } else if (Z_ISNULL_P(parameter)) { /* insert a NULL value into the column */ P->indicator = -1; /* NULL */ *bufpp = 0; diff --git a/thirdparty/php/curl/multi.cc b/thirdparty/php/curl/multi.cc index f7c5aa79855..609f2475d6e 100644 --- a/thirdparty/php/curl/multi.cc +++ b/thirdparty/php/curl/multi.cc @@ -42,7 +42,7 @@ void swoole_curl_multi_set_in_coroutine(php_curlm *mh, bool value) { bool swoole_curl_multi_is_in_coroutine(php_curlm *mh) { zval rv; zval *zv = zend_read_property_ex(nullptr, &mh->std, SW_ZSTR_KNOWN(SW_ZEND_STR_IN_COROUTINE), 1, &rv); - return zval_is_true(zv); + return zend_is_true(zv); } /* CurlMultiHandle class */ diff --git a/thirdparty/php/ssh2/ssh2.cc b/thirdparty/php/ssh2/ssh2.cc index 234d35ae1e8..4382017b9bf 100644 --- a/thirdparty/php/ssh2/ssh2.cc +++ b/thirdparty/php/ssh2/ssh2.cc @@ -147,7 +147,7 @@ LIBSSH2_MACERROR_FUNC(php_ssh2_macerror_cb) { if (FAILURE == call_user_function(NULL, NULL, data->macerror_cb, &zretval, 1, args)) { php_error_docref(NULL, E_WARNING, "Failure calling macerror callback"); } else { - retval = zval_is_true(&zretval) ? 0 : -1; + retval = zend_is_true(&zretval) ? 0 : -1; } if (Z_TYPE_P(&zretval) != IS_UNDEF) { zval_ptr_dtor(&zretval); diff --git a/thirdparty/php/ssh2/ssh2_fopen_wrappers.cc b/thirdparty/php/ssh2/ssh2_fopen_wrappers.cc index cb85abc2b13..975197f2d68 100644 --- a/thirdparty/php/ssh2/ssh2_fopen_wrappers.cc +++ b/thirdparty/php/ssh2/ssh2_fopen_wrappers.cc @@ -526,7 +526,7 @@ static php_stream *php_ssh2_shell_open(LIBSSH2_SESSION *session, php_error_docref( NULL, E_WARNING, "Failed setting %s=%s on remote end", ZSTR_VAL(key), Z_STRVAL(copyval)); } - zval_dtor(©val); + zval_ptr_dtor_nogc(©val); } } else { php_error_docref(NULL, E_NOTICE, "Skipping numeric index in environment array"); @@ -796,7 +796,7 @@ static php_stream *php_ssh2_exec_command(LIBSSH2_SESSION *session, php_error_docref( NULL, E_WARNING, "Failed setting %s=%s on remote end", ZSTR_VAL(key), Z_STRVAL(copyval)); } - zval_dtor(©val); + zval_ptr_dtor_nogc(©val); } } else { php_error_docref(NULL, E_NOTICE, "Skipping numeric index in environment array"); diff --git a/thirdparty/php82/pdo_odbc/odbc_stmt.c b/thirdparty/php82/pdo_odbc/odbc_stmt.c index 398e66ef684..c535f7dc948 100644 --- a/thirdparty/php82/pdo_odbc/odbc_stmt.c +++ b/thirdparty/php82/pdo_odbc/odbc_stmt.c @@ -777,7 +777,7 @@ static int odbc_stmt_set_param(pdo_stmt_t *stmt, zend_long attr, zval *val) { return 0; case PDO_ODBC_ATTR_ASSUME_UTF8: - S->assume_utf8 = zval_is_true(val); + S->assume_utf8 = zend_is_true(val); return 0; default: strcpy(S->einfo.last_err_msg, "Unknown Attribute"); diff --git a/thirdparty/php83/pdo_odbc/odbc_stmt.c b/thirdparty/php83/pdo_odbc/odbc_stmt.c index da75f668415..f01530c48b4 100644 --- a/thirdparty/php83/pdo_odbc/odbc_stmt.c +++ b/thirdparty/php83/pdo_odbc/odbc_stmt.c @@ -776,7 +776,7 @@ static int odbc_stmt_set_param(pdo_stmt_t *stmt, zend_long attr, zval *val) { return 0; case PDO_ODBC_ATTR_ASSUME_UTF8: - S->assume_utf8 = zval_is_true(val); + S->assume_utf8 = zend_is_true(val); return 0; default: strcpy(S->einfo.last_err_msg, "Unknown Attribute"); diff --git a/thirdparty/php84/curl/multi.cc b/thirdparty/php84/curl/multi.cc index 23a26261ece..c90610af724 100644 --- a/thirdparty/php84/curl/multi.cc +++ b/thirdparty/php84/curl/multi.cc @@ -44,7 +44,7 @@ void swoole_curl_multi_set_in_coroutine(php_curlm *mh, bool value) { bool swoole_curl_multi_is_in_coroutine(php_curlm *mh) { zval rv; zval *zv = zend_read_property_ex(nullptr, &mh->std, SW_ZSTR_KNOWN(SW_ZEND_STR_IN_COROUTINE), 1, &rv); - return zval_is_true(zv); + return zend_is_true(zv); } /* CurlMultiHandle class */ diff --git a/thirdparty/php84/pdo_odbc/odbc_stmt.c b/thirdparty/php84/pdo_odbc/odbc_stmt.c index 6bd65d205f9..84036f3d4be 100644 --- a/thirdparty/php84/pdo_odbc/odbc_stmt.c +++ b/thirdparty/php84/pdo_odbc/odbc_stmt.c @@ -776,7 +776,7 @@ static int odbc_stmt_set_param(pdo_stmt_t *stmt, zend_long attr, zval *val) { return 0; case PDO_ODBC_ATTR_ASSUME_UTF8: - S->assume_utf8 = zval_is_true(val); + S->assume_utf8 = zend_is_true(val); return 0; default: strcpy(S->einfo.last_err_msg, "Unknown Attribute"); From b2e95b03ae6e65f12b1688819dbf6a4d842803a8 Mon Sep 17 00:00:00 2001 From: arshidkv12 Date: Fri, 13 Mar 2026 06:20:24 +0530 Subject: [PATCH 2/2] Compile against PHP 8.6 --- ext-src/swoole_runtime.cc | 24 ++++++++++++------------ php_swoole_api.h | 6 ++++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/ext-src/swoole_runtime.cc b/ext-src/swoole_runtime.cc index 3f8e9ee176d..e5693e35ee0 100644 --- a/ext-src/swoole_runtime.cc +++ b/ext-src/swoole_runtime.cc @@ -176,7 +176,7 @@ static php_stream_ops ori_php_stream_stdio_ops; static void hook_func(const char *name, size_t l_name, zif_handler handler = nullptr, - zend_arg_info *arg_info = nullptr); + zend_func_arg_info *arg_info = nullptr); static void unhook_func(const char *name, size_t l_name); static bool extension_loaded(const char *name) { @@ -197,7 +197,7 @@ static bool class_exists(const char *name) { return !!ce; } -static zend_arg_info *get_arginfo(const char *name, size_t l_name) { +static zend_func_arg_info *get_arginfo(const char *name, size_t l_name) { auto *zf = zend::get_function(name, l_name); if (zf == nullptr) { return nullptr; @@ -205,12 +205,12 @@ static zend_arg_info *get_arginfo(const char *name, size_t l_name) { return zf->internal_function.arg_info; } -static zend_arg_info *copy_arginfo(const zend_internal_function *function, zend_arg_info *_arg_info) { +static zend_func_arg_info *copy_arginfo(const zend_internal_function *function, zend_func_arg_info *_arg_info) { uint32_t num_args = function->num_args + 1; - zend_arg_info *arg_info = _arg_info - 1; + zend_func_arg_info *arg_info = _arg_info - 1; - auto new_arg_info = static_cast(pemalloc(sizeof(zend_arg_info) * num_args, 1)); - memcpy(new_arg_info, arg_info, sizeof(zend_arg_info) * num_args); + auto new_arg_info = static_cast(pemalloc(sizeof(zend_func_arg_info) * num_args, 1)); + memcpy(new_arg_info, arg_info, sizeof(zend_func_arg_info) * num_args); if (function->fn_flags & ZEND_ACC_VARIADIC) { num_args++; @@ -250,8 +250,8 @@ static zend_arg_info *copy_arginfo(const zend_internal_function *function, zend_ return new_arg_info + 1; } -static void free_arg_info(const zend_internal_function *function, zend_arg_info *arg_info_copy) { - zend_arg_info *arg_info = arg_info_copy - 1; +static void free_arg_info(const zend_internal_function *function, zend_func_arg_info *arg_info_copy) { + zend_func_arg_info *arg_info = arg_info_copy - 1; uint32_t num_args = function->num_args + 1; if (function->fn_flags & ZEND_ACC_VARIADIC) { num_args++; @@ -275,7 +275,7 @@ static int runtime_hook_flags = 0; static zend_array *hook_function_table = nullptr; static std::unordered_map child_class_entries; static zend::ConcurrencyHashMap ori_func_handlers(nullptr); -static zend::ConcurrencyHashMap ori_func_arg_infos(nullptr); +static zend::ConcurrencyHashMap ori_func_arg_infos(nullptr); SW_EXTERN_C_BEGIN #include "ext/standard/file.h" @@ -338,9 +338,9 @@ void php_swoole_runtime_minit(int module_number) { struct PhpFunc { zend_function *function; - zend_arg_info *ori_arg_info; + zend_func_arg_info *ori_arg_info; zif_handler ori_handler; - zend_arg_info *arg_info_copy; + zend_func_arg_info *arg_info_copy; uint32_t ori_fn_flags; zend::Callable *fci_cache; zval name; @@ -2146,7 +2146,7 @@ static PHP_FUNCTION(swoole_stream_select) { RETURN_LONG(retval); } -static void hook_func(const char *name, size_t l_name, zif_handler handler, zend_arg_info *arg_info) { +static void hook_func(const char *name, size_t l_name, zif_handler handler, zend_func_arg_info *arg_info) { auto *rf = static_cast(zend_hash_str_find_ptr(hook_function_table, name, l_name)); bool use_php_func = false; /** diff --git a/php_swoole_api.h b/php_swoole_api.h index c811f245f3e..e9a6fd9de7f 100644 --- a/php_swoole_api.h +++ b/php_swoole_api.h @@ -57,6 +57,12 @@ static inline const char *zend_zval_value_name(const zval *arg) { } #endif +#if PHP_VERSION_ID >= 80600 +typedef zend_arg_info zend_func_arg_info; +#else +typedef zend_internal_arg_info zend_func_arg_info; +#endif + #ifdef __cplusplus } #endif