php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59943 ssh2_sftp_mkdir fails with trailing slash
Submitted: 2011-09-08 11:08 UTC Modified: 2011-09-21 14:42 UTC
From: james dot bench at spgroup dot co dot uk Assigned: bjori (profile)
Status: Closed Package: ssh2 (PECL)
PHP Version: 5.3.5 OS: Unbuntu 11.04 Server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: james dot bench at spgroup dot co dot uk
New email:
PHP Version: OS:

 

 [2011-09-08 11:08 UTC] james dot bench at spgroup dot co dot uk
Description:
------------
When attempting to create a directory using ssh2_sftp_mkdir the command will return false if the directory has a trailing slash, however the directory will be correctly created on the remote server.

Using the package from the Ubuntu 11.04 64bit repository, version 0.11.2-1.

Reproduce code:
---------------
$connection = ssh2_connect(...);
ssh2_auth_pubkey_file(...);
$sftp = ssh2_sftp($connection);

$dir = '/tmp/has/a/slash/';
var_dump(ssh2_sftp_mkdir($sftp, $dir, 0774, true)); // Returns false but the directory is created

$dir = '/tmp/has/no/slash';
var_dump(ssh2_sftp_mkdir($sftp, rtrim($dir, '/'), 0774, true)); // returns true and the directory is created

Expected result:
----------------
The code should print

bool(true)
bool(true)

and the directories /tmp/has/no/slash and /tmp/has/a/slash should both be created.

Actual result:
--------------
The code prints

bool(false)
bool(true)

and the directories /tmp/has/no/slash and /tmp/has/a/slash are both created.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-21 14:42 UTC] bjori@php.net
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC