From:             eric_intzandt at tvworks dot com
Operating system: linux red hat enterprise 4
PHP version:      5.2.6
PHP Bug Type:     Network related
Bug description:  issues when trying to receive file created with ssh2_exec 
from ssh2_scp_recv

Description:
------------
I create an ssh connection to server b.  I then call ssh2_exec to create a
file.  In the same connection, I then call ssh2_scp_recv to grab the file. 
However, this returns the file with a size of 0.  If I take out the
ssh2_exec() call, and just use ssh2_scp_recv with a pre-existing file it
works fine. see code



modules:
         './configure' '--host=x86_64-redhat-linux-gnu'
'--build=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux'
'--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr'
'--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
'--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64'
'--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--cache-file=../config.cache'
'--with-libdir=lib64' '--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic'
'--disable-rpath' '--without-pear' '--with-bz2' '--with-curl'
'--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr'
'--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp'
'--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png'
'--with-expat-dir=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif'
'--enable-ftp' '--enable-magic-quotes' '--enable-sockets'
'--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg'
'--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx'
'--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr'
'--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx'
'--enable-dio' '--without-mime-magic' '--with-libxml-dir=/usr' '--with-xml'
'--with-system-tzdata' '--with-apxs2=/usr/sbin/apxs' '--without-mysql'
'--without-gd' '--without-odbc' '--disable-dom' '--disable-dba'
'--without-unixODBC' '--disable-pdo' '--disable-xmlreader'
'--disable-xmlwriter' '--without-sqlite' '--disable-json'
'--without-pspell' 

Reproduce code:
---------------
////////////////////////
Assumes we are connecting to host B, from host A.
////////////////////////

$conn = ssh2_connect($host,22);
  if(ssh2_auth_password($conn,SSH_USER,SSH_PASS))
  {
    $command = "/usr/bin/pg_dump -F t -U ".COMMAND_USER." -d tv -f
/home/admin/command_db.tar -i";  
    ssh2_exec($conn, $command );//creates file successfully
   
ssh2_scp_recv($conn,'/home/admin/command_db.tar',$dir.'command/'.$host.'/command_db.tar');
  }
  else
    echo "Failed to authenticate";

Expected result:
----------------
I would expect a file command_db to be created on host b, then transferred
to host a.  

Actual result:
--------------
File gets created on host B, transferred to host A, but the filesize on
host A is 0.



-- 
Edit bug report at http://bugs.php.net/?id=46303&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=46303&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=46303&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=46303&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=46303&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=46303&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=46303&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=46303&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=46303&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=46303&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=46303&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=46303&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=46303&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=46303&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=46303&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=46303&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=46303&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=46303&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=46303&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=46303&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=46303&r=mysqlcfg

Reply via email to