From 4a732acb7ccdbb4a4e20ef6c8915a9372d9b2aaa Mon Sep 17 00:00:00 2001 From: Silas Joisten Date: Thu, 15 May 2025 07:45:21 +0200 Subject: [PATCH 1/3] Adds support for `ftp_raw` on PHP 8.1 --- generated/8.1/ftp.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/generated/8.1/ftp.php b/generated/8.1/ftp.php index ead4b0a7..2c481228 100644 --- a/generated/8.1/ftp.php +++ b/generated/8.1/ftp.php @@ -411,6 +411,28 @@ function ftp_pwd(\FTP\Connection $ftp): string } +/** + * Sends an arbitrary command to the FTP server. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param string $command The command to execute. + * @return array Returns the server's response as an array of strings. + * No parsing is performed on the response string, nor does + * ftp_raw determine if the command succeeded. + * @throws FtpException + * + */ +function ftp_raw(\FTP\Connection $ftp, string $command): array +{ + error_clear_last(); + $safeResult = \ftp_raw($ftp, $command); + if ($safeResult === null) { + throw FtpException::createFromPhpError(); + } + return $safeResult; +} + + /** * ftp_rename renames a file or a directory on the FTP * server. From 4e778347667a83c7a81ea6f63db341ce00149806 Mon Sep 17 00:00:00 2001 From: Silas Joisten Date: Thu, 15 May 2025 08:11:13 +0200 Subject: [PATCH 2/3] Fix --- generated/8.1/ftp.php | 22 ---------------------- generated/8.1/functionsList.php | 1 + generated/8.1/rector-migrate.php | 1 + generated/8.2/ftp.php | 22 ---------------------- generated/8.3/ftp.php | 22 ---------------------- generated/8.4/ftp.php | 22 ---------------------- generated/8.5/ftp.php | 22 ---------------------- lib/special_cases.php | 22 ++++++++++++++++++++++ 8 files changed, 24 insertions(+), 110 deletions(-) diff --git a/generated/8.1/ftp.php b/generated/8.1/ftp.php index 2c481228..ead4b0a7 100644 --- a/generated/8.1/ftp.php +++ b/generated/8.1/ftp.php @@ -411,28 +411,6 @@ function ftp_pwd(\FTP\Connection $ftp): string } -/** - * Sends an arbitrary command to the FTP server. - * - * @param \FTP\Connection $ftp An FTP\Connection instance. - * @param string $command The command to execute. - * @return array Returns the server's response as an array of strings. - * No parsing is performed on the response string, nor does - * ftp_raw determine if the command succeeded. - * @throws FtpException - * - */ -function ftp_raw(\FTP\Connection $ftp, string $command): array -{ - error_clear_last(); - $safeResult = \ftp_raw($ftp, $command); - if ($safeResult === null) { - throw FtpException::createFromPhpError(); - } - return $safeResult; -} - - /** * ftp_rename renames a file or a directory on the FTP * server. diff --git a/generated/8.1/functionsList.php b/generated/8.1/functionsList.php index c170d754..ab935c58 100644 --- a/generated/8.1/functionsList.php +++ b/generated/8.1/functionsList.php @@ -213,6 +213,7 @@ 'ftp_pasv', 'ftp_put', 'ftp_pwd', + 'ftp_raw', 'ftp_rename', 'ftp_rmdir', 'ftp_site', diff --git a/generated/8.1/rector-migrate.php b/generated/8.1/rector-migrate.php index f74d9bc4..7dc92343 100644 --- a/generated/8.1/rector-migrate.php +++ b/generated/8.1/rector-migrate.php @@ -221,6 +221,7 @@ 'ftp_pasv' => 'Safe\ftp_pasv', 'ftp_put' => 'Safe\ftp_put', 'ftp_pwd' => 'Safe\ftp_pwd', + 'ftp_raw' => 'Safe\ftp_raw', 'ftp_rename' => 'Safe\ftp_rename', 'ftp_rmdir' => 'Safe\ftp_rmdir', 'ftp_site' => 'Safe\ftp_site', diff --git a/generated/8.2/ftp.php b/generated/8.2/ftp.php index 2c481228..ead4b0a7 100644 --- a/generated/8.2/ftp.php +++ b/generated/8.2/ftp.php @@ -411,28 +411,6 @@ function ftp_pwd(\FTP\Connection $ftp): string } -/** - * Sends an arbitrary command to the FTP server. - * - * @param \FTP\Connection $ftp An FTP\Connection instance. - * @param string $command The command to execute. - * @return array Returns the server's response as an array of strings. - * No parsing is performed on the response string, nor does - * ftp_raw determine if the command succeeded. - * @throws FtpException - * - */ -function ftp_raw(\FTP\Connection $ftp, string $command): array -{ - error_clear_last(); - $safeResult = \ftp_raw($ftp, $command); - if ($safeResult === null) { - throw FtpException::createFromPhpError(); - } - return $safeResult; -} - - /** * ftp_rename renames a file or a directory on the FTP * server. diff --git a/generated/8.3/ftp.php b/generated/8.3/ftp.php index 2c481228..ead4b0a7 100644 --- a/generated/8.3/ftp.php +++ b/generated/8.3/ftp.php @@ -411,28 +411,6 @@ function ftp_pwd(\FTP\Connection $ftp): string } -/** - * Sends an arbitrary command to the FTP server. - * - * @param \FTP\Connection $ftp An FTP\Connection instance. - * @param string $command The command to execute. - * @return array Returns the server's response as an array of strings. - * No parsing is performed on the response string, nor does - * ftp_raw determine if the command succeeded. - * @throws FtpException - * - */ -function ftp_raw(\FTP\Connection $ftp, string $command): array -{ - error_clear_last(); - $safeResult = \ftp_raw($ftp, $command); - if ($safeResult === null) { - throw FtpException::createFromPhpError(); - } - return $safeResult; -} - - /** * ftp_rename renames a file or a directory on the FTP * server. diff --git a/generated/8.4/ftp.php b/generated/8.4/ftp.php index a7393331..f5b87f06 100644 --- a/generated/8.4/ftp.php +++ b/generated/8.4/ftp.php @@ -441,28 +441,6 @@ function ftp_pwd(\FTP\Connection $ftp): string } -/** - * Sends an arbitrary command to the FTP server. - * - * @param \FTP\Connection $ftp An FTP\Connection instance. - * @param string $command The command to execute. - * @return array Returns the server's response as an array of strings. - * No parsing is performed on the response string, nor does - * ftp_raw determine if the command succeeded. - * @throws FtpException - * - */ -function ftp_raw(\FTP\Connection $ftp, string $command): array -{ - error_clear_last(); - $safeResult = \ftp_raw($ftp, $command); - if ($safeResult === null) { - throw FtpException::createFromPhpError(); - } - return $safeResult; -} - - /** * ftp_rename renames a file or a directory on the FTP * server. diff --git a/generated/8.5/ftp.php b/generated/8.5/ftp.php index a7393331..f5b87f06 100644 --- a/generated/8.5/ftp.php +++ b/generated/8.5/ftp.php @@ -441,28 +441,6 @@ function ftp_pwd(\FTP\Connection $ftp): string } -/** - * Sends an arbitrary command to the FTP server. - * - * @param \FTP\Connection $ftp An FTP\Connection instance. - * @param string $command The command to execute. - * @return array Returns the server's response as an array of strings. - * No parsing is performed on the response string, nor does - * ftp_raw determine if the command succeeded. - * @throws FtpException - * - */ -function ftp_raw(\FTP\Connection $ftp, string $command): array -{ - error_clear_last(); - $safeResult = \ftp_raw($ftp, $command); - if ($safeResult === null) { - throw FtpException::createFromPhpError(); - } - return $safeResult; -} - - /** * ftp_rename renames a file or a directory on the FTP * server. diff --git a/lib/special_cases.php b/lib/special_cases.php index 3b191ffe..47bb77c6 100644 --- a/lib/special_cases.php +++ b/lib/special_cases.php @@ -9,6 +9,7 @@ namespace Safe; use Safe\Exceptions\ExecException; +use Safe\Exceptions\FtpException; use Safe\Exceptions\MiscException; use Safe\Exceptions\PosixException; use Safe\Exceptions\SocketsException; @@ -429,3 +430,24 @@ function passthru(string $command, ?int &$result_code = null): void throw ExecException::createFromPhpError(); } } + +/** + * Sends an arbitrary command to the FTP server. + * + * @param \FTP\Connection $ftp An FTP\Connection instance. + * @param string $command The command to execute. + * @return array Returns the server's response as an array of strings. + * No parsing is performed on the response string, nor does + * ftp_raw determine if the command succeeded. + * @throws FtpException + * + */ +function ftp_raw(\FTP\Connection $ftp, string $command): array +{ + error_clear_last(); + $safeResult = \ftp_raw($ftp, $command); + if ($safeResult === null) { + throw FtpException::createFromPhpError(); + } + return $safeResult; +} From 5b62423029419c8f3d3d866b2f2fec344f02c679 Mon Sep 17 00:00:00 2001 From: Silas Joisten Date: Thu, 15 May 2025 08:14:18 +0200 Subject: [PATCH 3/3] fix --- lib/special_cases.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/special_cases.php b/lib/special_cases.php index 47bb77c6..cb5513bf 100644 --- a/lib/special_cases.php +++ b/lib/special_cases.php @@ -436,7 +436,7 @@ function passthru(string $command, ?int &$result_code = null): void * * @param \FTP\Connection $ftp An FTP\Connection instance. * @param string $command The command to execute. - * @return array Returns the server's response as an array of strings. + * @return string[] Returns the server's response as an array of strings. * No parsing is performed on the response string, nor does * ftp_raw determine if the command succeeded. * @throws FtpException