php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35892 ftp_raw dont wait on reply from server
Submitted: 2006-01-04 14:23 UTC Modified: 2006-01-04 21:47 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: michal86 at gmail dot com Assigned:
Status: Not a bug Package: FTP related
PHP Version: 5.0.5 OS: Debian
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: michal86 at gmail dot com
New email:
PHP Version: OS:

 

 [2006-01-04 14:23 UTC] michal86 at gmail dot com
Description:
------------
hello..

im connecting to ftp with ftp_pasv() on true, i wanna apply few cmd's with ftp_raw() (like for example in reproducecode).

just like in example, msg from command "test1" will be showed in var $y, which is a bug?

in perl is something like $ftp->message() or something like that, to wait for msg from server after raw command..

Reproduce code:
---------------
$x=ftp_raw($ftp,"test1");
print $x; // nothing will return
$y=ftp_raw($ftp,"test2");
print $y; // will return msg from cmd test1, $x=$y?

Expected result:
----------------
after run the code:

$x=ftp_raw($ftp,"test1");
print $x; // will wait for reply from server on cmd test1, then execute rest code

$y=ftp_raw($ftp,"test2");
print $y; // after reply on cmd:test1, will send raw cmd:test2.. 

vars $x/$y will have result of cmd test1/test2

or second way is write function to read msg() from server in pasv mode

Actual result:
--------------
$x=ftp_raw($ftp,"test1");
print $x; // nothing will return, code will exec normall
$y=ftp_raw($ftp,"test2");
print $y; // will return msg from cmd test1, $x=$y?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-04 15:00 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2006-01-04 20:25 UTC] michal86 at gmail dot com
Tony, here is the code:

<?php
$f=ftp_connect("localhost",7000);
ftp_login($f,"user","pass");
ftp_pasv($f,true);
$x=ftp_raw($f,"CWD /");
print_r($x); //here is return
ftp_quit($f);
?>

[RETURN ARRAY]
Array (
[0] => 250- welcome msg
[...]
[6] => 250 CWD command successful.
)
[END OF RETURN]

array[0->5] showed me welcome msg from ftpserv..
array[6] as you know, its answer ftpserv on CWD command


i think, ftp_raw() should return only array[6] without prev msg, just ignore it, or put in last row in array() :)

i tested it on php6, latest 5.1, 5.0..
 [2006-01-04 20:43 UTC] sniper@php.net
Can you please explain what the bug is supposed to be?
All I can see is that this works exactly like it should be working.
 [2006-01-04 20:51 UTC] michal86 at gmail dot com
ftp_raw() should return msg from cmd which execute in function, not few msg from prev. exec. commands.. just like in example..

Sniper, maybe php should have new function? for reading last msg from connection? like in perl ?
 [2006-01-04 21:47 UTC] sniper@php.net
There's something wrong with the FTP server you're connecting to. This worked fine for me when I connect to ftp.funet.fi.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon May 23 16:05:44 2022 UTC