|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22402 fopen with ftp url
Submitted: 2003-02-24 14:43 UTC Modified: 2003-02-24 22:21 UTC
From: jan+php at jancm dot org Assigned: iliaa (profile)
Status: Closed Package: FTP related
PHP Version: 4.3.1 OS: Win2K
Private report: No CVE-ID: None
 [2003-02-24 14:43 UTC] jan+php at jancm dot org
fopen will, apparently, always open a pasv mode data connection (to a ftp type url). Most ftp servers return a code of:
150 "File status okay; about to open data connection",
but in some cases they return a
125 "125 Data connection already open; transfer starting."

(It really depends on the server. WarFTP will return a 125);

fopen works fine when a 150 is returned. It breaks when a 125 is returned instead.

I *think* the only change needed is in line 418 of
ext\standard\ftp_fopen_wrapper.c (based on 4.3.1 source), but I can't compile it to check. :(

Currently it reads:
	if (result != 150) {
and I think it should be:
	if (result != 150 && result != 125) {

RFC 959
also see ext\ftp\ftp.c
     lines: 683, 765, 1473, 1581, and 1694
(the ftp functions all work fine in both passive and active modes).


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-24 22:21 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Feb 26 00:01:27 2024 UTC