Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/ftp/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if test "$PHP_FTP" = "yes"; then
AC_DEFINE([HAVE_FTP], [1],
[Define to 1 if the PHP extension 'ftp' is available.])
PHP_NEW_EXTENSION([ftp], [php_ftp.c ftp.c], [$ext_shared])

PHP_INSTALL_HEADERS([ext/ftp], [php_ftp.h])
AS_VAR_IF([PHP_FTP_SSL], [no],, [
PHP_SETUP_OPENSSL([FTP_SHARED_LIBADD])
PHP_SUBST([FTP_SHARED_LIBADD])
Expand Down
2 changes: 1 addition & 1 deletion ext/ftp/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ARG_ENABLE("ftp", "ftp support", "no");
if (PHP_FTP != "no") {

EXTENSION("ftp", "php_ftp.c ftp.c");

PHP_INSTALL_HEADERS("ext/ftp/", "php_ftp.h");
var ret = SETUP_OPENSSL("ftp", PHP_FTP);

if (ret >= 2) {
Expand Down
3 changes: 2 additions & 1 deletion ext/ftp/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#endif

#include "php.h"
#include "php_ftp.h"

#include <stdio.h>
#include <ctype.h>
Expand Down Expand Up @@ -1378,7 +1379,7 @@ static int my_poll(php_socket_t fd, int events, int timeout) {

while (true) {
zend_hrtime_t start_ns = zend_hrtime();
n = php_pollfd_for_ms(fd, events, (int) (timeout_hr / 1000000));
n = php_ftp_pollfd_for_ms(fd, events, (int) (timeout_hr / 1000000));

if (n == -1 && php_socket_errno() == EINTR) {
zend_hrtime_t delta_ns = zend_hrtime() - start_ns;
Expand Down
2 changes: 2 additions & 0 deletions ext/ftp/php_ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

static zend_class_entry *php_ftp_ce = NULL;
static zend_object_handlers ftp_object_handlers;
PHP_FTP_API int(*php_ftp_pollfd_for_ms)(php_socket_t, int, int);

zend_module_entry php_ftp_module_entry = {
STANDARD_MODULE_HEADER_EX,
Expand Down Expand Up @@ -109,6 +110,7 @@ PHP_MINIT_FUNCTION(ftp)
ftp_object_handlers.clone_obj = NULL;

register_ftp_symbols(module_number);
php_ftp_pollfd_for_ms = php_pollfd_for_ms;

return SUCCESS;
}
Expand Down
13 changes: 13 additions & 0 deletions ext/ftp/php_ftp.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ extern zend_module_entry php_ftp_module_entry;
#define phpext_ftp_ptr &php_ftp_module_entry

#include "php_version.h"
#include "php_network.h"
#define PHP_FTP_VERSION PHP_VERSION

#define PHP_FTP_OPT_TIMEOUT_SEC 0
Expand All @@ -32,4 +33,16 @@ extern zend_module_entry php_ftp_module_entry;
PHP_MINIT_FUNCTION(ftp);
PHP_MINFO_FUNCTION(ftp);

#ifdef PHP_WIN32
#define PHP_FTP_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
#define PHP_FTP_API __attribute__ ((visibility("default")))
#else
#define PHP_FTP_API
#endif

/* expose this interface to enable coroutine support for FTP in other extensions
*/
PHP_FTP_API extern int(*php_ftp_pollfd_for_ms)(php_socket_t, int, int);

#endif