-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
Description
phan 3.2 reports:
apps/files_external/lib/Lib/Storage/SFTP.php:320 PhanUndeclaredConstant Reference to undeclared constant \NET_SFTP_TYPE_REGULAR. This will cause a thrown Error in php 8.0+.
apps/files_external/lib/Lib/Storage/SFTP.php:324 PhanUndeclaredConstant Reference to undeclared constant \NET_SFTP_TYPE_DIRECTORY. This will cause a thrown Error in php 8.0+.
apps/files_external/lib/Lib/Storage/SFTP.php:422 PhanUndeclaredConstant Reference to undeclared constant \NET_SFTP_LOCAL_FILE. This will cause a thrown Error in php 8.0+.
e.g. https://drone.owncloud.com/owncloud/core/27639/5/7
Investigated if these really are undeclared constants, or if they somehow become available via phpseclib at run-time.
I don't see unit tests that exercise the methods in which those constants are used. My IDE also tells me they are undeclared constants. So maybe there is a real problem here?
public function filetype($path) {
try {
$stat = $this->getConnection()->stat($this->absPath($path));
if ($stat['type'] == NET_SFTP_TYPE_REGULAR) {
return 'file';
}
if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) {
return 'dir';
}
} catch (\Exception $e) {
}
return false;
}
public function uploadFile($path, $target) {
$this->getConnection()->put($target, $path, NET_SFTP_LOCAL_FILE);
}