|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58846 ssh2_scp_send doesn't work under libssh2 1.2 on symlink
Submitted: 2009-08-31 23:46 UTC Modified: 2012-10-16 19:08 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: amiroot at yahoo dot com Assigned:
Status: Open Package: ssh2 (PECL)
PHP Version: 5.2.10 OS: RHEL
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2009-08-31 23:46 UTC] amiroot at yahoo dot com
I'm not sure it is a bug on libssh2 or the PECL package. 

I'm using ssh2 0.11 and libssh2 1.1 and recently I upgrade the libssh2 to 1.2. The upgrade goes quite smooth. I've some symlink on my remote machine I use ssh2 function to copy files inside the symlink folder. After upgrade libssh2 to 1.2 I found that the upload doesn't work for those symlink folders. A warning message prompt me that upload failed and only small part of the file is uploaded.

When I downgrade libssh2 back to 1.1 the problem get fixed. Anyone encountered the same problem?

Reproduce code:
$connection = ssh2_connect($val["ftp_host"], $val["ftp_port"]);
ssh2_auth_password($connection, $val["ftp_username"], $val["ftp_password"]);
ssh2_scp_send($connection, $local_file, $remote_file, 0664);

Expected result:
No error message at all.

Actual result:
Only part of the file being uploaded with an error message like this:

Warning:  ssh2_scp_send() [function.ssh2-scp-send]: Failed copying file in /xxx on line 24


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-25 08:13 UTC] stant at bestyle dot ru
I can confirm this bug.

PHP 5.2.10 (cli) (built: Sep 12 2009 19:15:01)
FreeBSD 7.0-RELEASE-p1
 [2009-11-29 20:54 UTC] dwash59_2000 at yahoo dot com
+1 on this bug, seen on libssh2 1.2.2, fixed by reverting to 1.1 .
 [2011-08-16 10:40 UTC] fedesh03 at hotmail dot com
I confirm the Issue!
 [2012-06-23 11:23 UTC]
-Status: Open +Status: Feedback
 [2012-06-23 11:23 UTC]
I cannot reproduce this bug, even with old libssh2 1.2.2 packages from ubuntu.

Can you check if this problem still exists?
 [2012-06-24 05:53 UTC] amiroot at yahoo dot com
The file I tried is a binary file. Have you tried something like PDF or JPG? A file in around 1MB will suffice to replicate the issue.
 [2012-10-06 09:12 UTC]
-Status: Feedback +Status: Open
 [2012-10-06 09:12 UTC]
Could you give the latest TRUNK version a try? I've modified the ssh2_scp_send() 
code. It should be fixed, but if it's not, it is much more verbose about error 
situations than it previously was.
 [2012-10-16 19:08 UTC]
A new ssh2 package is released. Please see if problem still occurs.
 [2012-10-17 09:26 UTC] amiroot at yahoo dot com
Unfortunately the new release hasn't fixed the issue.

Here are the environment I tested it.

OS: Linux RHEL4
libssh: 1.2.4
PHP: 5.2.17
SSH: 0.12
Code: Exactly the same as what I submitted in the initial comment.
No error at all. The file was uploaded to the remote server but the size is a little bit smaller. I tried a PDF (3MB) and a PPT (4.8M). The file uploaded left only 2.3M and 4.3M.
 [2024-07-12 06:26 UTC] willson453tom at gmail dot com
Thanks for creating this bug. (
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 20 10:01:29 2024 UTC