Bug #54947 [Opn]: ssh2.sftp protocol wrapper works incorrectly for paths which contain a '#'

From: Date: Sun, 29 May 2011 17:59:34 +0000
Subject: Bug #54947 [Opn]: ssh2.sftp protocol wrapper works incorrectly for paths which contain a '#'
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-161042@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54947&edit=1

 ID:                 54947
 User updated by:    josvanbakel at gmail dot com
 Reported by:        josvanbakel at gmail dot com
 Summary:            ssh2.sftp protocol wrapper works incorrectly for
                     paths which contain a '#'
 Status:             Open
 Type:               Bug
 Package:            *Network Functions
 Operating System:   Ubuntu
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Thanks for the tip. I'll give it a try.


Previous Comments:
------------------------------------------------------------------------
[2011-05-29 16:53:37] zelnaga at gmail dot com

You'd probably have more success with phpseclib, a pure PHP SFTP
implementation:

http://phpseclib.sourceforge.net/

Doesn't absolve the maintainer of the php_ssh2.dll from fixing this bug
but it's a work around you can none-the-less use until the problem is
fixed.

------------------------------------------------------------------------
[2011-05-28 15:42:31] josvanbakel at gmail dot com

Description:
------------
When trying to read a file or directory via the ssh2.sftp protocol
wrapper which contains a '#' in the path ssh2.sftp will ignore it. It
looks like it treats the '#' as a start comment command (e.g. // in
PHP)

In the test script, i have used the following directory structure:

#Test/
    a
Test#/
    b
Test/
    c

Note that creating the directories from the bash shell requires escaping
the # with a \, e.g.: mkdir \#Test

Test script:
---------------
// $sftp is a ssh2_sftp resource
// $dir is the directory containing the test directory structure (see
description)
$root = "ssh2.sftp://$sftp/$dir";

$a = scandir("$root/#Test");
// $a = array(".", "..", "#Test", "Test#",
"Test");
// Note that $a is a dir listing of $root, everything after the # is
ignored

$b = scandir("$root/Test#");
// $b = array(".", "..", "c");
// Gives a listing of Test not of Test#

Expected result:
----------------
$a = array(".", "..", "a");
$b = array(".", "..", "b");

Actual result:
--------------
$a = array(".", "..", "#Test", "Test#", "Test");
$b = array(".", "..", "c");


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



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


Thread (4 messages)

« previous php.bugs (#161042) next »