Bug #73561 [Com]: opendir() using a ssh2.sftp:// resource does not work

From: Date: Thu, 16 Mar 2017 04:59:14 +0000
Subject: Bug #73561 [Com]: opendir() using a ssh2.sftp:// resource does not work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207866@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73561&edit=1

 ID:                 73561
 Comment by:         rahul dot thacker at radixweb dot com
 Reported by:        sascha dot pfalz at ivz dot de
 Summary:            opendir() using a ssh2.sftp:// resource does not
                     work
 Status:             Duplicate
 Type:               Bug
 Package:            Directory function related
 Operating System:   Red Hat Linux 7.2
 PHP Version:        7.0.13
 Block user comment: N
 Private report:     N

 New Comment:

As per improved path security, this type of path is not allowed in later versions of php, I got
working solution by converting resource Id to integer.

$yourResourceId=ssh2_connect($host,$port);

$sftp=intVal($yourResourceId);


Previous Comments:
------------------------------------------------------------------------
[2016-11-18 10:40:50] requinix@php.net

Another duplicate of bug #73506

------------------------------------------------------------------------
[2016-11-18 10:10:08] sascha dot pfalz at ivz dot de

Description:
------------
I'm using the ssh2 Extension (1.0) together with PHP 7 to work on SSH enabled servers.
When trying to read a directory on the SSH2 via the ssh2.sftp:// wrapper,
I've got the following error under 7.0.13:

PHP Warning:  opendir(ssh2.sftp://Resource id #49/test): failed to open
dir: operation failed

Using exactly the same code with the same ssh2 extension under PHP 7.0.12 everything works as
expected.




Test script:
---------------
$dirname  = sprintf("ssh2.sftp://%s%s",$this->SFTP,"/test");
$handle   = opendir($dirname);




Expected result:
----------------
Getting a directory handle ready to traverse the entries with readdir().

Actual result:
--------------
$handle is boolean(false) instead of directory handle, and this warning is printed:

PHP Warning:  opendir(ssh2.sftp://Resource id #7/ivz-export/test/):
failed to open dir: operation failed in ivz_sftp2.class.php on line 98



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=73561&edit=1


Thread (3 messages)

« previous php.bugs (#207866) next »