Bug #74816 [NEW]: Multiple ssh2-sftp connections will all point to the first one
| From: | andreas dot buchenrieder at check24 dot de | Date: | Mon, 26 Jun 2017 15:57:40 +0000 |
| Subject: | Bug #74816 [NEW]: Multiple ssh2-sftp connections will all point to the first one | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-209684@lists.php.net to get a copy of this message | ||
From: andreas dot buchenrieder at check24 dot de
Operating system: Linux
PHP version: 7.1.6
Package: opcache
Bug Type: Bug
Bug description:Multiple ssh2-sftp connections will all point to the first one
Description:
------------
PHP-Version: 7.1.6-2+0~20170614060700.1+jessie~1.gbp831871
I open multiple ssh2 connections in a loop. In my case the server itself
is always the same, but the username/password changes. So I cannot say
if this error happens if the server changes as well
Basically each file should be put on a different account
With opcache enabled, every file is uploaded on the first connection,
even though it should always be a new one. The streams meta data even
shows a new resource id for each connection
This does not happen in PHP 5.6 or with opcache disabled
Test script:
---------------
<?php
$configs = [
['host', 'username', 'password', '/path/'],
// ...
];
while (true) {
$index = array_rand($configs);
list($host, $username, $password, $path) = $configs[$index];
$port = 22;
$connection = ssh2_connect($host, 22);
if ($connection === false) {
continue;
}
if (!ssh2_auth_password($connection, $username, $password)) {
continue;
}
$sftp = ssh2_sftp($connection);
$handle = @fopen('ssh2.sftp://' . intval($sftp) . $path .
$username,
'w+');
if ($handle === false) {
continue;
}
print_r(stream_get_meta_data($handle));
fclose($handle);
}
--
Edit bug report at https://bugs.php.net/bug.php?id=74816&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74816&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74816&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74816&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74816&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74816&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74816&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74816&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74816&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74816&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74816&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74816&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74816&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74816&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74816&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74816&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74816&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74816&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74816&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74816&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74816&r=mysqlcfg