From e6a66c5272b10729acb02181bdc1a80c322028fa Mon Sep 17 00:00:00 2001 From: Ayesh Karunaratne Date: Sat, 8 May 2021 16:58:42 +0530 Subject: [PATCH] Move FTP extension class `FTPConnection` to `FTP\Connection` With the [namespaces in bundled extensions RFC](https://wiki.php.net/rfc/namespaces_in_bundled_extensions) passed, renaming the new `\FTPConnection` class to `\FTP\Connection`. This also adds an entry to `./UPGRADING` file. Related: #6925, #5945 --- NEWS | 2 +- UPGRADING | 4 ++ ext/ftp/ftp.stub.php | 84 ++++++++++++++++-------------- ext/ftp/ftp_arginfo.h | 66 +++++++++++------------ ext/ftp/php_ftp.c | 6 +-- ext/ftp/tests/007.phpt | 66 +++++++++++------------ ext/ftp/tests/dead-resource.phpt | 4 +- ext/ftp/tests/ftp_constructor.phpt | 6 +-- 8 files changed, 124 insertions(+), 114 deletions(-) diff --git a/NEWS b/NEWS index 0eb806c19023a..1e00cf6d5c8b3 100644 --- a/NEWS +++ b/NEWS @@ -54,7 +54,7 @@ PHP NEWS (Paulius Sapragonas) - FTP: - . Convert resource to object \FTPConnection. (Sara) + . Convert resource to object \FTP\Connection. (Sara) - GD: . Convert resource to object \GdFont. (Sara) diff --git a/UPGRADING b/UPGRADING index f29b5513beee0..6d0a20c3450bf 100644 --- a/UPGRADING +++ b/UPGRADING @@ -62,6 +62,10 @@ PHP 8.1 UPGRADE NOTES . The fileinfo functions now accept and return, respectively, finfo objects instead of resources. +- FTP: + . The FTP functions now accept and return, respectively, FTP\Connection objects + instead of resources. + - IMAP: . The IMAP functions now accept and return, respectively, IMAP\Connection objects instead of resources. diff --git a/ext/ftp/ftp.stub.php b/ext/ftp/ftp.stub.php index 2aaa5140f3697..3f39f3185c1e6 100644 --- a/ext/ftp/ftp.stub.php +++ b/ext/ftp/ftp.stub.php @@ -2,62 +2,68 @@ /** @generate-class-entries */ -/** @strict-properties */ -final class FTPConnection -{ +namespace FTP { + /** @strict-properties */ + final class Connection + { + } } -function ftp_connect(string $hostname, int $port = 21, int $timeout = 90): FTPConnection|false {} +namespace { + +function ftp_connect(string $hostname, int $port = 21, int $timeout = 90): FTP\Connection|false {} #ifdef HAVE_FTP_SSL -function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90): FTPConnection|false {} +function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90): FTP\Connection|false {} #endif -function ftp_login(FTPConnection $ftp, string $username, string $password): bool {} -function ftp_pwd(FTPConnection $ftp): string|false {} -function ftp_cdup(FTPConnection $ftp): bool {} -function ftp_chdir(FTPConnection $ftp, string $directory): bool {} -function ftp_exec(FTPConnection $ftp, string $command): bool {} -function ftp_raw(FTPConnection $ftp, string $command): array {} -function ftp_mkdir(FTPConnection $ftp, string $directory): string|false {} -function ftp_rmdir(FTPConnection $ftp, string $directory): bool {} -function ftp_chmod(FTPConnection $ftp, int $permissions, string $filename): int|false {} +function ftp_login(FTP\Connection $ftp, string $username, string $password): bool {} +function ftp_pwd(FTP\Connection $ftp): string|false {} +function ftp_cdup(FTP\Connection $ftp): bool {} +function ftp_chdir(FTP\Connection $ftp, string $directory): bool {} +function ftp_exec(FTP\Connection $ftp, string $command): bool {} +function ftp_raw(FTP\Connection $ftp, string $command): array {} +function ftp_mkdir(FTP\Connection $ftp, string $directory): string|false {} +function ftp_rmdir(FTP\Connection $ftp, string $directory): bool {} +function ftp_chmod(FTP\Connection $ftp, int $permissions, string $filename): int|false {} /** @param string $response */ -function ftp_alloc(FTPConnection $ftp, int $size, &$response = null): bool {} -function ftp_nlist(FTPConnection $ftp, string $directory): array|false {} -function ftp_rawlist(FTPConnection $ftp, string $directory, bool $recursive = false): array|false {} -function ftp_mlsd(FTPConnection $ftp, string $directory): array|false {} -function ftp_systype(FTPConnection $ftp): string|false {} +function ftp_alloc(FTP\Connection $ftp, int $size, &$response = null): bool {} +function ftp_nlist(FTP\Connection $ftp, string $directory): array|false {} +function ftp_rawlist(FTP\Connection $ftp, string $directory, bool $recursive = false): array|false {} +function ftp_mlsd(FTP\Connection $ftp, string $directory): array|false {} +function ftp_systype(FTP\Connection $ftp): string|false {} /** @param resource $stream */ -function ftp_fget(FTPConnection $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool {} +function ftp_fget(FTP\Connection $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool {} /** @param resource $stream */ -function ftp_nb_fget(FTPConnection $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int {} -function ftp_pasv(FTPConnection $ftp, bool $enable): bool {} -function ftp_get(FTPConnection $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool {} -function ftp_nb_get(FTPConnection $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int {} -function ftp_nb_continue(FTPConnection $ftp): int {} +function ftp_nb_fget(FTP\Connection $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int {} +function ftp_pasv(FTP\Connection $ftp, bool $enable): bool {} +function ftp_get(FTP\Connection $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): bool {} +function ftp_nb_get(FTP\Connection $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): int {} +function ftp_nb_continue(FTP\Connection $ftp): int {} /** @param resource $stream */ -function ftp_fput(FTPConnection $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): bool {} +function ftp_fput(FTP\Connection $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): bool {} /** @param resource $stream */ -function ftp_nb_fput(FTPConnection $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): int {} -function ftp_put(FTPConnection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): bool {} -function ftp_append(FTPConnection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY): bool {} -function ftp_nb_put(FTPConnection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): int|false {} -function ftp_size(FTPConnection $ftp, string $filename): int {} -function ftp_mdtm(FTPConnection $ftp, string $filename): int {} -function ftp_rename(FTPConnection $ftp, string $from, string $to): bool {} -function ftp_delete(FTPConnection $ftp, string $filename): bool {} -function ftp_site(FTPConnection $ftp, string $command): bool {} -function ftp_close(FTPConnection $ftp): bool {} +function ftp_nb_fput(FTP\Connection $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): int {} +function ftp_put(FTP\Connection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): bool {} +function ftp_append(FTP\Connection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY): bool {} +function ftp_nb_put(FTP\Connection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): int|false {} +function ftp_size(FTP\Connection $ftp, string $filename): int {} +function ftp_mdtm(FTP\Connection $ftp, string $filename): int {} +function ftp_rename(FTP\Connection $ftp, string $from, string $to): bool {} +function ftp_delete(FTP\Connection $ftp, string $filename): bool {} +function ftp_site(FTP\Connection $ftp, string $command): bool {} +function ftp_close(FTP\Connection $ftp): bool {} /** @alias ftp_close */ -function ftp_quit(FTPConnection $ftp): bool {} +function ftp_quit(FTP\Connection $ftp): bool {} /** @param int|bool $value */ -function ftp_set_option(FTPConnection $ftp, int $option, $value): bool {} -function ftp_get_option(FTPConnection $ftp, int $option): int|bool {} +function ftp_set_option(FTP\Connection $ftp, int $option, $value): bool {} +function ftp_get_option(FTP\Connection $ftp, int $option): int|bool {} + +} diff --git a/ext/ftp/ftp_arginfo.h b/ext/ftp/ftp_arginfo.h index 7553304b6294c..67d15fd4b6ba2 100644 --- a/ext/ftp/ftp_arginfo.h +++ b/ext/ftp/ftp_arginfo.h @@ -1,14 +1,14 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: db52e4b33562b93173c41d00f20e313553b173b4 */ + * Stub hash: 0ea788bc7779d9c340b9fb3ad72fa0571df9341e */ -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_ftp_connect, 0, 1, FTPConnection, MAY_BE_FALSE) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_ftp_connect, 0, 1, FTP\\Connection, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, port, IS_LONG, 0, "21") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_LONG, 0, "90") ZEND_END_ARG_INFO() #if defined(HAVE_FTP_SSL) -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_ftp_ssl_connect, 0, 1, FTPConnection, MAY_BE_FALSE) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_ftp_ssl_connect, 0, 1, FTP\\Connection, MAY_BE_FALSE) ZEND_ARG_TYPE_INFO(0, hostname, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, port, IS_LONG, 0, "21") ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, timeout, IS_LONG, 0, "90") @@ -16,60 +16,60 @@ ZEND_END_ARG_INFO() #endif ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_login, 0, 3, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, username, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, password, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_pwd, 0, 1, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_cdup, 0, 1, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_chdir, 0, 2, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_exec, 0, 2, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_raw, 0, 2, IS_ARRAY, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, command, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_mkdir, 0, 2, MAY_BE_STRING|MAY_BE_FALSE) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0) ZEND_END_ARG_INFO() #define arginfo_ftp_rmdir arginfo_ftp_chdir ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_chmod, 0, 3, MAY_BE_LONG|MAY_BE_FALSE) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, permissions, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_alloc, 0, 2, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, response, "null") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_nlist, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_rawlist, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, directory, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, recursive, _IS_BOOL, 0, "false") ZEND_END_ARG_INFO() @@ -79,7 +79,7 @@ ZEND_END_ARG_INFO() #define arginfo_ftp_systype arginfo_ftp_pwd ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_fget, 0, 3, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_INFO(0, stream) ZEND_ARG_TYPE_INFO(0, remote_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "FTP_BINARY") @@ -87,7 +87,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_fget, 0, 3, _IS_BOOL, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_nb_fget, 0, 3, IS_LONG, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_INFO(0, stream) ZEND_ARG_TYPE_INFO(0, remote_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "FTP_BINARY") @@ -95,12 +95,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_nb_fget, 0, 3, IS_LONG, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_pasv, 0, 2, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, enable, _IS_BOOL, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_get, 0, 3, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, local_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, remote_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "FTP_BINARY") @@ -108,7 +108,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_get, 0, 3, _IS_BOOL, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_nb_get, 0, 3, IS_LONG, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, local_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, remote_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "FTP_BINARY") @@ -116,11 +116,11 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_nb_get, 0, 3, IS_LONG, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_nb_continue, 0, 1, IS_LONG, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_fput, 0, 3, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, remote_filename, IS_STRING, 0) ZEND_ARG_INFO(0, stream) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "FTP_BINARY") @@ -128,7 +128,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_fput, 0, 3, _IS_BOOL, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_nb_fput, 0, 3, IS_LONG, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, remote_filename, IS_STRING, 0) ZEND_ARG_INFO(0, stream) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "FTP_BINARY") @@ -136,7 +136,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_nb_fput, 0, 3, IS_LONG, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_put, 0, 3, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, remote_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, local_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "FTP_BINARY") @@ -144,14 +144,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_put, 0, 3, _IS_BOOL, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_append, 0, 3, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, remote_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, local_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "FTP_BINARY") ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_nb_put, 0, 3, MAY_BE_LONG|MAY_BE_FALSE) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, remote_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, local_filename, IS_STRING, 0) ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "FTP_BINARY") @@ -159,20 +159,20 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_nb_put, 0, 3, MAY_BE_LONG|MA ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_size, 0, 2, IS_LONG, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_END_ARG_INFO() #define arginfo_ftp_mdtm arginfo_ftp_size ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_rename, 0, 3, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, from, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, to, IS_STRING, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_delete, 0, 2, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -183,13 +183,13 @@ ZEND_END_ARG_INFO() #define arginfo_ftp_quit arginfo_ftp_cdup ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_ftp_set_option, 0, 3, _IS_BOOL, 0) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_ftp_get_option, 0, 2, MAY_BE_LONG|MAY_BE_BOOL) - ZEND_ARG_OBJ_INFO(0, ftp, FTPConnection, 0) + ZEND_ARG_OBJ_INFO(0, ftp, FTP\\Connection, 0) ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -276,15 +276,15 @@ static const zend_function_entry ext_functions[] = { }; -static const zend_function_entry class_FTPConnection_methods[] = { +static const zend_function_entry class_FTP_Connection_methods[] = { ZEND_FE_END }; -static zend_class_entry *register_class_FTPConnection(void) +static zend_class_entry *register_class_FTP_Connection(void) { zend_class_entry ce, *class_entry; - INIT_CLASS_ENTRY(ce, "FTPConnection", class_FTPConnection_methods); + INIT_NS_CLASS_ENTRY(ce, "FTP", "Connection", class_FTP_Connection_methods); class_entry = zend_register_internal_class_ex(&ce, NULL); class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES; diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c index 227c9d61bb49d..d653f9792bd42 100644 --- a/ext/ftp/php_ftp.c +++ b/ext/ftp/php_ftp.c @@ -83,7 +83,7 @@ static zend_object* ftp_object_create(zend_class_entry* ce) { } static zend_function *ftp_object_get_constructor(zend_object *zobj) { - zend_throw_error(NULL, "Cannot directly construct FTPConnection, use ftp_connect() or ftp_ssl_connect() instead"); + zend_throw_error(NULL, "Cannot directly construct FTP\\Connection, use ftp_connect() or ftp_ssl_connect() instead"); return NULL; } @@ -108,7 +108,7 @@ PHP_MINIT_FUNCTION(ftp) #endif #endif - php_ftp_ce = register_class_FTPConnection(); + php_ftp_ce = register_class_FTP_Connection(); php_ftp_ce->create_object = ftp_object_create; php_ftp_ce->serialize = zend_class_serialize_deny; php_ftp_ce->unserialize = zend_class_unserialize_deny; @@ -229,7 +229,7 @@ PHP_FUNCTION(ftp_ssl_connect) #define GET_FTPBUF(ftpbuf, zftp) \ ftpbuf = ftp_object_from_zend_object(Z_OBJ_P(zftp))->ftp; \ if (!ftpbuf) { \ - zend_throw_exception(zend_ce_value_error, "FTPConnection is already closed", 0); \ + zend_throw_exception(zend_ce_value_error, "FTP\\Connection is already closed", 0); \ RETURN_THROWS(); \ } diff --git a/ext/ftp/tests/007.phpt b/ext/ftp/tests/007.phpt index 71a706238c780..a23b5496be91d 100644 --- a/ext/ftp/tests/007.phpt +++ b/ext/ftp/tests/007.phpt @@ -179,36 +179,36 @@ try { fclose($ftp); ?> --EXPECT-- -ftp_login(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_pwd(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_cdup(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_chdir(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_exec(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_raw(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_mkdir(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_rmdir(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_chmod(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_alloc(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_nlist(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_rawlist(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_mlsd(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_systype(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_fget(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_nb_fget(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_pasv(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_get(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_nb_get(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_nb_continue(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_fput(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_nb_fput(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_put(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_append(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_nb_put(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_size(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_mdtm(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_rename(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_delete(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_site(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_close(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_set_option(): Argument #1 ($ftp) must be of type FTPConnection, resource given -ftp_get_option(): Argument #1 ($ftp) must be of type FTPConnection, resource given +ftp_login(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_pwd(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_cdup(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_chdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_exec(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_raw(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_mkdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_rmdir(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_chmod(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_alloc(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_nlist(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_rawlist(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_mlsd(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_systype(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_fget(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_nb_fget(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_pasv(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_get(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_nb_get(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_nb_continue(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_fput(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_nb_fput(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_put(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_append(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_nb_put(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_size(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_mdtm(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_rename(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_delete(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_site(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_close(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_set_option(): Argument #1 ($ftp) must be of type FTP\Connection, resource given +ftp_get_option(): Argument #1 ($ftp) must be of type FTP\Connection, resource given diff --git a/ext/ftp/tests/dead-resource.phpt b/ext/ftp/tests/dead-resource.phpt index 358ec11ed6c70..0d4e780dcc49c 100644 --- a/ext/ftp/tests/dead-resource.phpt +++ b/ext/ftp/tests/dead-resource.phpt @@ -1,5 +1,5 @@ --TEST-- -Attempt to use a closed FTPConnection +Attempt to use a closed FTP\Connection --EXTENSIONS-- ftp pcntl @@ -21,4 +21,4 @@ try { --EXPECT-- bool(true) bool(true) -Exception: FTPConnection is already closed +Exception: FTP\Connection is already closed diff --git a/ext/ftp/tests/ftp_constructor.phpt b/ext/ftp/tests/ftp_constructor.phpt index 146df8436c164..efdfbcdecea2c 100644 --- a/ext/ftp/tests/ftp_constructor.phpt +++ b/ext/ftp/tests/ftp_constructor.phpt @@ -1,5 +1,5 @@ --TEST-- -Attempt to instantiate an FTPConnection directly +Attempt to instantiate an FTP\Connection directly --EXTENSIONS-- ftp pcntl @@ -7,9 +7,9 @@ pcntl getMessage(), "\n"; } --EXPECT-- -Exception: Cannot directly construct FTPConnection, use ftp_connect() or ftp_ssl_connect() instead +Exception: Cannot directly construct FTP\Connection, use ftp_connect() or ftp_ssl_connect() instead