Closed
Description
Description
The following code:
<?php
private function getRawExecResponseCode($command)
{
$response = @ftp_raw($this->connection, trim($command));
return (int) preg_replace('/\D/', '', implode(' ', $response)); // <---- line 577; $response is of type `string`
}
For complete file see: https://github.com/thephpleague/flysystem/blob/1.x/src/Adapter/Ftp.php#L577
Resulted in this output:
In Ftp.php line 577:
implode(): Argument #1 ($pieces) must be of type array, string given
But I expected this output instead:
$result = $this->getRawExecResponseCode('CWD mydirectory');
echo $result;
// 250
Apparently the native ftp_raw
method returns a string
as return value instead of array|null
.
Setting the connection configuration passive = true
fixes the issue for now.
But this kind of type errors should not occur.
Related to: thephpleague/flysystem#1481
PHP Version
PHP 8.0.19
Operating System
CentOS Linux release 7.9.2009 (Core)