From eb71a6da75e602fdd77ed110fc01a3a0989d12b3 Mon Sep 17 00:00:00 2001 From: Yan Hu Date: Tue, 10 May 2022 10:31:27 +0800 Subject: [PATCH] Detect if stream metadata has wrapper_type set for SFTP put() method --- phpseclib/Net/SFTP.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index a08b1b5e..4d5c4200 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -2328,7 +2328,7 @@ class Net_SFTP extends Net_SSH2 case is_resource($data): $mode = $mode & ~NET_SFTP_LOCAL_FILE; $info = stream_get_meta_data($data); - if ($info['wrapper_type'] == 'PHP' && $info['stream_type'] == 'Input') { + if (isset($info['wrapper_type']) && $info['wrapper_type'] == 'PHP' && $info['stream_type'] == 'Input') { $fp = fopen('php://memory', 'w+'); stream_copy_to_stream($data, $fp); rewind($fp);