php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1565 fopen not working with ftp files
Submitted: 1999-06-18 09:01 UTC Modified: 1999-06-22 10:48 UTC
From: support at elysium dot demon dot co dot uk Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.9 OS: Linux
Private report: No CVE-ID: None
 [1999-06-18 09:01 UTC] support at elysium dot demon dot co dot uk
See Bug id #1547  -- the example code snippet in this bug report did contain a valid ftp ref.  However it was parsed out by the bug system.

fopen does not seem to open ftp files.  I am have tried compiling in the latest version of fopen-wrapper.c (1.63) but even this doesn't work.  http files are opening fine.  I have tried several different ftp servers (all capable of passive mode).

Sorry that I have submitted another bug, but my username/password combo. didn't allow me to edit the bug?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-20 21:59 UTC] jim at cvs dot php dot net
Fixed in CVS.
 [1999-06-21 04:02 UTC] support at elysium dot demon dot co dot uk
Not quite fixed.

Works fine now for http:// files (with username password combo) but does
not work for ftp:// files

try getting the README file from ftp.sunsite.org.uk without the username/password
combo and then with username: anonymous and password anonymous.  It
doesn't seem in both cases with 1.66 (fopen-wrappers.c)

ta.

 [1999-06-22 10:43 UTC] support at elysium dot demon dot co dot uk
We have found one of the problems, and fixed it in 
fopen-wrappers (1.60).

Not all ftp servers (e.g. on SUNs) support the SIZE command,
so you have to check the return codes in respect to this.

Here is a diff of 1.60 and the fixed version of 1.60:

759c759
<                       if (result != 500 && result != 502 && (result > 299 || result < 200)) {
---
>                       if (result > 299 || result < 200) {
769c769
<                       if (result != 500 && result != 502 && (result > 299 || result < 200)) {
---
>                       if (result <= 299 && result >= 200) {
917d916
<
 [1999-06-22 10:48 UTC] sas at cvs dot php dot net
Thanks for the patch - I've applied it slightly changed.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 18:00:02 2026 UTC