From:             
Operating system: Ubuntu
PHP version:      Irrelevant
Package:          *Network Functions
Bug Type:         Bug
Bug description:ssh2.sftp protocol wrapper works incorrectly for paths which 
contain a '#'

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 bug report at http://bugs.php.net/bug.php?id=54947&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54947&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54947&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54947&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54947&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54947&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54947&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54947&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54947&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54947&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54947&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54947&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54947&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54947&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54947&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54947&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54947&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54947&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54947&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54947&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54947&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54947&r=mysqlcfg

Reply via email to