|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-11-15 09:25 UTC] af at ins dot de
Description:
------------
When using scandir() over a ssh2-stream scandir creates a segmentation fault.
We have tested this with libSSH2 1.7.0 and libSSH 1.8.0.
When we downgrade to PHP 5.6.27 (tested with libSSH2 1.7.0 and libSSH 1.8.0) the segmentation fault does not occur and the script works as expected.
Test script:
---------------
<?php
$ssh2 = ssh2_connect('ftp.yourdomain.de', 22);
if (!ssh2_auth_password($ssh2, 'yourusername','yourpassword')) {
echo("auth error\n");
exit();
}
$sftp = ssh2_sftp($ssh2);
$te='ssh2.sftp://'.$sftp.'/receive/';
echo('te='.$te."\n");
echo("before scandir!\n");
$files = scandir($te,SCANDIR_SORT_ASCENDING );
echo("after scandir!\n");
if ($files===false)
echo("scandir error\n");
else
echo("scandir success\n");
Expected result:
----------------
te=ssh2.sftp://Resource id #5/receive/
before scandir!
after scandir!
scandir success
Actual result:
--------------
te=ssh2.sftp://Resource id #5/receive/
before scandir!
Segmentation fault
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 08:00:02 2025 UTC |
Since upgrading to 5.6.28, I experience problems with mkdir("ssh2.sftp://$conn/$dir") and ssh2_sftp_mkdir($conn, $dir) calls always returning bool(false): - mkdir("ssh2.sftp://$conn/$dir") returns bool(false), no error messages are printed on error_log, and the directory is not created. - ssh2_sftp_mkdir($conn_sftp, $dir) returns bool(false), no error messages are printed on error_log, but the directory is correctly created. Reverting to PHP 5.6.27 corrects these problems. - Ubuntu 12.04 - PHP 5.6.28 (from Ondřej Surý) - php-ssh2 0.13 (from Ondřej Surý) - libssh2 1.2.8-2 (from Ubuntu)Same problem with PHP 5.6.29-0+deb8u1. Segfaults, if the ssh2.sftp-Wrapper is used. Like "if(!is_dir('ssh2.sftp://'.$this->sftp_con.$dir))"