Skip to content

Commit 65fa9ae

Browse files
committed
Removal of the #ifdef PHP_ASYNC_API condition from the project.
1 parent 1d55624 commit 65fa9ae

20 files changed

+26
-267
lines changed

configure.ac

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,10 +1660,8 @@ PHP_ADD_SOURCES([main], m4_normalize([
16601660
]),
16611661
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
16621662

1663-
if test "$PHP_ASYNC_API" = "yes"; then
16641663
PHP_ADD_SOURCES([main], m4_normalize([network_async.c]),
16651664
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
1666-
fi
16671665

16681666
if printf "#if __ELF__\nelf\n#endif\n" | $CC -E - | grep elf > /dev/null; then
16691667
PHP_ADD_SOURCES([main], [debug_gdb_scripts.c])

ext/curl/config.m4

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,11 @@ if test "$PHP_CURL" != "no"; then
7272
[AC_MSG_FAILURE([The libcurl check failed.])],
7373
[$CURL_LIBS])
7474

75-
curl_sources="interface.c multi.c share.c curl_file.c"
75+
curl_sources="interface.c multi.c share.c curl_file.c curl_async.c"
7676

77-
if test "$PHP_ASYNC_API" = "yes"; then
78-
curl_sources="$curl_sources curl_async.c"
79-
PKG_CHECK_MODULES([CURL_ASYNC], [libcurl >= 7.87.0], [], [
80-
AC_MSG_ERROR([libcurl >= 7.87.0 is required for TrueAsync due to curl_multi_socket_action crashes in earlier versions])
81-
])
82-
fi
77+
PKG_CHECK_MODULES([CURL_ASYNC], [libcurl >= 7.87.0], [], [
78+
AC_MSG_ERROR([libcurl >= 7.87.0 is required for TrueAsync due to curl_multi_socket_action crashes in earlier versions])
79+
])
8380

8481
PHP_NEW_EXTENSION([curl],
8582
[$curl_sources],

ext/curl/config.w32

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ if (PHP_CURL != "no") {
1414
CHECK_LIB("libssh2.lib", "curl", PHP_CURL) &&
1515
CHECK_LIB("nghttp2.lib", "curl", PHP_CURL))
1616
) {
17-
var curl_sources = "interface.c multi.c share.c curl_file.c";
18-
if (typeof PHP_ASYNC_API !== "undefined" && PHP_ASYNC_API == "yes") {
19-
curl_sources += " curl_async.c";
20-
}
17+
var curl_sources = "interface.c multi.c share.c curl_file.c curl_async.c";
2118
EXTENSION("curl", curl_sources);
2219
AC_DEFINE('HAVE_CURL', 1, "Define to 1 if the PHP extension 'curl' is available.");
2320
ADD_FLAG("CFLAGS_CURL", "/D PHP_CURL_EXPORTS=1");

ext/curl/curl_private.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,9 @@ typedef struct {
132132
struct {
133133
int no;
134134
} err;
135-
#ifdef PHP_ASYNC_API
136135
// A pointer to an event that can be triggered when the Multi CURL finishes waiting for all handlers.
137136
// This is used to wake up the coroutine that is waiting for the multi handle to complete.
138137
void *async_event;
139-
#endif
140138
zend_object std;
141139
} php_curlm;
142140

ext/curl/interface.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
#include <curl/curl.h>
3535
#include <curl/easy.h>
3636

37-
#ifdef PHP_ASYNC_API
3837
#include "curl_async.h"
39-
#endif
4038

4139
/* As of curl 7.11.1 this is no longer defined inside curl.h */
4240
#ifndef HttpPost
@@ -176,15 +174,13 @@ void _php_curl_verify_handlers(php_curl *ch, bool reporterror) /* {{{ */
176174
}
177175
/* }}} */
178176

179-
#ifdef PHP_ASYNC_API
180177
/* {{{ */
181178
PHP_RSHUTDOWN_FUNCTION(curl)
182179
{
183180
curl_async_shutdown();
184181
return SUCCESS;
185182
}
186183
/* }}} */
187-
#endif
188184

189185
/* {{{ curl_module_entry */
190186
zend_module_entry curl_module_entry = {
@@ -194,11 +190,7 @@ zend_module_entry curl_module_entry = {
194190
PHP_MINIT(curl),
195191
PHP_MSHUTDOWN(curl),
196192
NULL,
197-
#ifdef PHP_ASYNC_API
198193
PHP_RSHUTDOWN(curl),
199-
#else
200-
NULL,
201-
#endif
202194
PHP_MINFO(curl),
203195
PHP_CURL_VERSION,
204196
PHP_MODULE_GLOBALS(curl),
@@ -2421,15 +2413,11 @@ PHP_FUNCTION(curl_exec)
24212413

24222414
_php_curl_cleanup_handle(ch);
24232415

2424-
#ifdef PHP_ASYNC_API
24252416
if (ZEND_ASYNC_IS_ACTIVE) {
24262417
error = curl_async_perform(ch->cp);
24272418
} else {
24282419
error = curl_easy_perform(ch->cp);
24292420
}
2430-
#else
2431-
error = curl_easy_perform(ch->cp);
2432-
#endif
24332421
SAVE_CURL_ERROR(ch, error);
24342422

24352423
if (error != CURLE_OK) {

ext/curl/multi.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@
2424
#include "Zend/zend_smart_str.h"
2525

2626
#include "curl_private.h"
27-
#ifdef PHP_ASYNC_API
2827
#include "curl_async.h"
29-
#endif
3028

3129
#include <curl/curl.h>
3230
#include <curl/multi.h>
@@ -223,15 +221,11 @@ PHP_FUNCTION(curl_multi_select)
223221
RETURN_THROWS();
224222
}
225223

226-
#ifdef PHP_ASYNC_API
227224
if (ZEND_ASYNC_IS_ACTIVE) {
228225
error = curl_async_select(mh, (int) (timeout * 1000.0), &numfds);
229226
} else {
230227
error = curl_multi_wait(mh->multi, NULL, 0, (int) (timeout * 1000.0), &numfds);
231228
}
232-
#else
233-
error = curl_multi_wait(mh->multi, NULL, 0, (int) (timeout * 1000.0), &numfds);
234-
#endif
235229
if (CURLM_OK != error) {
236230
SAVE_CURLM_ERROR(mh, error);
237231
RETURN_LONG(-1);
@@ -271,15 +265,11 @@ PHP_FUNCTION(curl_multi_exec)
271265
}
272266

273267
still_running = zval_get_long(z_still_running);
274-
#ifdef PHP_ASYNC_API
275268
if (ZEND_ASYNC_IS_ACTIVE) {
276269
error = curl_async_multi_perform(mh, &still_running);
277270
} else {
278271
error = curl_multi_perform(mh->multi, &still_running);
279272
}
280-
#else
281-
error = curl_multi_perform(mh->multi, &still_running);
282-
#endif
283273
ZEND_TRY_ASSIGN_REF_LONG(z_still_running, still_running);
284274

285275
SAVE_CURLM_ERROR(mh, error);
@@ -372,11 +362,9 @@ PHP_FUNCTION(curl_multi_close)
372362

373363
mh = Z_CURL_MULTI_P(z_mh);
374364

375-
#ifdef PHP_ASYNC_API
376365
if (mh->async_event) {
377366
curl_async_dtor(mh);
378367
}
379-
#endif
380368

381369
for (pz_ch = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); pz_ch;
382370
pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
@@ -575,9 +563,7 @@ static void curl_multi_free_obj(zend_object *object)
575563
{
576564
php_curlm *mh = curl_multi_from_obj(object);
577565

578-
#ifdef PHP_ASYNC_API
579566
curl_async_dtor(mh);
580-
#endif
581567

582568
zend_llist_position pos;
583569
php_curl *ch;

ext/sockets/php_sockets.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@
3333
# define IS_INVALID_SOCKET(a) (a->bsd_socket < 0)
3434
#endif
3535

36-
#ifdef PHP_ASYNC_API
3736
/* Helper macro to avoid compiler warnings about equal expressions */
3837
#ifdef PHP_WIN32
3938
# define IS_EAGAIN_OR_EWOULDBLOCK(err) ((err) == EAGAIN || (err) == EWOULDBLOCK)
4039
#else
4140
# define IS_EAGAIN_OR_EWOULDBLOCK(err) ((err) == EAGAIN)
4241
# define INVALID_SOCKET (-1)
4342
#endif
44-
#endif
4543

4644
#define PHP_SOCKETS_VERSION PHP_VERSION
4745

@@ -81,15 +79,13 @@ typedef struct {
8179
int type;
8280
int error;
8381
int blocking;
84-
#ifdef PHP_ASYNC_API
8582
/* Equals TRUE if the socket was transferred to a nonblocking mode */
8683
bool non_blocking;
8784
/*
8885
* socket type, e.g. SOCK_STREAM, SOCK_DGRAM
8986
* Needed to understand how to work with the buffer correctly.
9087
*/
9188
int socket_type;
92-
#endif
9389
zval zstream;
9490
zend_object std;
9591
} php_socket;

ext/sockets/sockaddr_conv.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#include <php.h>
22
#include <php_network.h>
33
#include "php_sockets.h"
4-
#ifdef PHP_ASYNC_API
54
#include "main/network_async.h"
6-
#endif
75

86
#ifdef PHP_WIN32
97
#include "windows_common.h"
@@ -15,11 +13,7 @@
1513
extern zend_result php_string_to_if_index(const char *val, unsigned *out);
1614

1715
#ifdef HAVE_IPV6
18-
#ifdef PHP_ASYNC_API
1916
# define FREEADDRINFO(addrinfo) is_async ? ZEND_ASYNC_FREEADDRINFO(addrinfo) : freeaddrinfo(addrinfo)
20-
#else
21-
# define FREEADDRINFO(addrinfo) freeaddrinfo(addrinfo)
22-
#endif
2317
/* Sets addr by hostname, or by ip in string form (AF_INET6) */
2418
int php_set_inet6_addr(struct sockaddr_in6 *sin6, zend_string *string, php_socket *php_sock) /* {{{ */
2519
{
@@ -42,7 +36,6 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, zend_string *string, php_socke
4236
#else
4337
hints.ai_flags = AI_ADDRCONFIG;
4438
#endif
45-
#ifdef PHP_ASYNC_API
4639
bool is_async = ZEND_ASYNC_IS_ACTIVE;
4740

4841
if (is_async) {
@@ -62,16 +55,6 @@ int php_set_inet6_addr(struct sockaddr_in6 *sin6, zend_string *string, php_socke
6255
#endif
6356
return 0;
6457
}
65-
#else
66-
if (getaddrinfo(ZSTR_VAL(string), NULL, &hints, &addrinfo) != 0) {
67-
#ifdef PHP_WIN32
68-
PHP_SOCKET_ERROR(php_sock, "Host lookup failed", WSAGetLastError());
69-
#else
70-
PHP_SOCKET_ERROR(php_sock, "Host lookup failed", (-10000 - h_errno));
71-
#endif
72-
return 0;
73-
}
74-
#endif
7558

7659
if (!addrinfo) {
7760
#ifdef PHP_WIN32

0 commit comments

Comments
 (0)