Skip to content

Commit 55838ec

Browse files
authored
feat(PHP 8.1): support for ftp_raw (#693)
1 parent 325287b commit 55838ec

File tree

7 files changed

+25
-88
lines changed

7 files changed

+25
-88
lines changed

generated/8.1/functionsList.php

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/8.1/rector-migrate.php

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/8.2/ftp.php

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/8.3/ftp.php

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/8.4/ftp.php

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generated/8.5/ftp.php

Lines changed: 0 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/special_cases.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace Safe;
1010

1111
use Safe\Exceptions\ExecException;
12+
use Safe\Exceptions\FtpException;
1213
use Safe\Exceptions\MiscException;
1314
use Safe\Exceptions\PosixException;
1415
use Safe\Exceptions\SocketsException;
@@ -491,3 +492,25 @@ function hash_hmac_file(string $algo, string $filename, string $key, bool $binar
491492
}
492493
return $safeResult;
493494
}
495+
496+
/**
497+
* Sends an arbitrary command to the FTP server.
498+
*
499+
* @param \FTP\Connection $ftp An FTP\Connection instance.
500+
* @param string $command The command to execute.
501+
* @phpstan-return string[]
502+
* @return array Returns the server's response as an array of strings.
503+
* No parsing is performed on the response string, nor does
504+
* ftp_raw determine if the command succeeded.
505+
* @throws FtpException
506+
*
507+
*/
508+
function ftp_raw(\FTP\Connection $ftp, string $command): array
509+
{
510+
error_clear_last();
511+
$safeResult = \ftp_raw($ftp, $command);
512+
if ($safeResult === null) {
513+
throw FtpException::createFromPhpError();
514+
}
515+
return $safeResult;
516+
}

0 commit comments

Comments
 (0)