-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix native-curl crash on PHP8 (#4045)
* fix native-curl crash on PHP8 * optimize code * optimize code[2] * fix tests * optimize code[3] * fix tests
- Loading branch information
Showing
7 changed files
with
149 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#pragma once | ||
|
||
#include "php_swoole_cxx.h" | ||
|
||
#ifdef SW_USE_CURL | ||
SW_EXTERN_C_BEGIN | ||
|
||
#include <curl/curl.h> | ||
#include <curl/multi.h> | ||
|
||
void swoole_native_curl_minit(int module_number); | ||
void swoole_native_curl_mshutdown(); | ||
|
||
PHP_FUNCTION(swoole_native_curl_close); | ||
PHP_FUNCTION(swoole_native_curl_copy_handle); | ||
PHP_FUNCTION(swoole_native_curl_errno); | ||
PHP_FUNCTION(swoole_native_curl_error); | ||
PHP_FUNCTION(swoole_native_curl_exec); | ||
PHP_FUNCTION(swoole_native_curl_getinfo); | ||
PHP_FUNCTION(swoole_native_curl_init); | ||
PHP_FUNCTION(swoole_native_curl_setopt); | ||
PHP_FUNCTION(swoole_native_curl_setopt_array); | ||
|
||
#if LIBCURL_VERSION_NUM >= 0x070c01 /* 7.12.1 */ | ||
PHP_FUNCTION(swoole_native_curl_reset); | ||
#endif | ||
|
||
#if LIBCURL_VERSION_NUM >= 0x070f04 /* 7.15.4 */ | ||
PHP_FUNCTION(swoole_native_curl_escape); | ||
PHP_FUNCTION(swoole_native_curl_unescape); | ||
#endif | ||
|
||
#if LIBCURL_VERSION_NUM >= 0x071200 /* 7.18.0 */ | ||
PHP_FUNCTION(swoole_native_curl_pause); | ||
#endif | ||
SW_EXTERN_C_END | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,10 @@ | |
| Author: Tianfeng Han <[email protected]> | | ||
+----------------------------------------------------------------------+ | ||
*/ | ||
#pragma once | ||
|
||
#ifdef SW_USE_CURL | ||
|
||
#pragma once | ||
|
||
#include "php_swoole_cxx.h" | ||
#include "swoole_util.h" | ||
|
||
|
@@ -85,7 +84,7 @@ class cURLMulti { | |
} | ||
|
||
void add_timer(long timeout_ms) { | ||
if (timer) { | ||
if (timer && swoole_timer_is_available()) { | ||
swoole_timer_del(timer); | ||
} | ||
|
||
|
@@ -95,7 +94,7 @@ class cURLMulti { | |
} | ||
|
||
void del_timer() { | ||
if (timer) { | ||
if (timer && swoole_timer_is_available()) { | ||
swoole_timer_del(timer); | ||
} | ||
} | ||
|
Oops, something went wrong.