php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63509 ftp_chmod returns false for response "250 Changed."
Submitted: 2012-11-14 03:11 UTC Modified: 2018-03-20 17:52 UTC
Votes:3
Avg. Score:3.7 ± 1.9
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: egor dot chernodarov at gmail dot com Assigned:
Status: Open Package: FTP related
PHP Version: 5.3.18 OS: Debian GNU/Linux 6.0
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: egor dot chernodarov at gmail dot com
New email:
PHP Version: OS:

 

 [2012-11-14 03:11 UTC] egor dot chernodarov at gmail dot com
Description:
------------
NcFTPd server returns "250 Changed." (not 200 as many other servers):

[root@vps ~]# ftp ****.com
Connected to ****.com (64.***.***.***).
220 ****.com NcFTPd Server (licensed copy) ready.
Name (*****.com:root): ****
331 User test okay, need password.
Password:
230-You are user #1 of 20 simultaneous users allowed.
230-
230 Restricted user logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd public_html/test345
250 "/public_html/test345" is new cwd.
ftp> ls page9.php
227 Entering Passive Mode (***,***,**,***,***,**)
150 Data connection accepted from ***.***.***.**:****; transfer starting.
-rwxr-xr-x   1 test   test       14637 Jul 28 00:06 page9.php
226 Listing completed.
ftp> chmod 777 page9.php
250 Changed.
ftp> ls page9.php
227 Entering Passive Mode (*****)
150 Data connection accepted from ****:46124; transfer starting.
-rwxrwxrwx   1 test   test       14637 Jul 28 00:06 page9.php
226 Listing completed.

Code "250" looks as valid for such operations:
250 - Requested file action okay, completed.

But ftp_chmode returns "true" only for code 200.

Test script:
---------------
Just try ftp_chmod for any file on NcFTPd server. Permissions successfully changed but result is "false".
Not sure if any other servers returns 250, but I've tested on ncftpd-2.8.3-freebsd6.0-i386-export.tar.gz.

Expected result:
----------------
Expect "true" for successful ftp_chmod on NcFTPd server.

Actual result:
--------------
ftp_chmod always returns false.

As workaround:
ftp_site($connectHandler, sprintf('CHMOD %o %s', $mode, $absolutePath));

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-19 16:59 UTC] cmb@php.net
> Code "250" looks as valid for such operations:

Well, it is not, according to RFC 959[1].

[1] <https://tools.ietf.org/html/rfc959#page-49>
 [2018-03-20 06:23 UTC] egor dot chernodarov at gmail dot com
Funny flashback to 6 years back, but why not?

Quote from this RFC:
"250 Requested file action okay, completed."

So, it still looks as valid code for such operations.
 [2018-03-20 17:52 UTC] cmb@php.net
If I'm not mistaken, the FTP chmod is implemented via the SITE
command, and RFC 959 lists the possible success replies of this
command as 200 and 202[1].

Anyhow, as I've stated in bug #64841:

| I'm not sure whether we should be more liberal in what we
| accept.

This topic warrants some discussion on the internals@ mailing
list.

[1] <https://tools.ietf.org/html/rfc959#page-52>
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 12 07:01:37 2019 UTC