Skip to content

Commit

Permalink
fix undefined index notice in stream touch()
Browse files Browse the repository at this point in the history
  • Loading branch information
lightray22 authored and terrafrost committed Feb 22, 2021
1 parent d20e842 commit 488db53
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion phpseclib/Net/SFTP/Stream.php
Expand Up @@ -465,7 +465,9 @@ function _stream_metadata($path, $option, $var)
// and https://github.com/php/php-src/blob/master/main/php_streams.h#L592
switch ($option) {
case 1: // PHP_STREAM_META_TOUCH
return $this->sftp->touch($path, $var[0], $var[1]);
$time = isset($var[0]) ? $var[0] : null;
$atime = isset($var[1]) ? $var[1] : null;
return $this->sftp->touch($path, $time, $atime);
case 2: // PHP_STREAM_OWNER_NAME
case 3: // PHP_STREAM_GROUP_NAME
return false;
Expand Down

1 comment on commit 488db53

@terrafrost
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #1615

Please sign in to comment.