php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65392 Warning for a success message with ftp_chdir
Submitted: 2013-08-05 09:45 UTC Modified: 2021-08-15 04:22 UTC
Votes:4
Avg. Score:3.8 ± 0.4
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (33.3%)
From: Laurent dot Lyaudet at gmail dot com Assigned: cmb (profile)
Status: No Feedback Package: FTP related
PHP Version: 5.4.17 OS: Debian Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-08-05 09:45 UTC] Laurent dot Lyaudet at gmail dot com
Description:
------------
Hi,

I found the following trace in an error log of a php script I launch as background task.

//-----------------------------------------------------------------------
root@wheezyDEVLaurent:~# more /home/web/teliedi/log/logErreur.txt
2013-08-05 : 11:05:11 :  000002 | runPersistant.php
                                   | ftp_chdir(): Requested file action okay, co
mpleted.
2013-08-05 : 11:05:11 : CALLSTACK - DESC (Nb ignores : 1, Nb limite : 0)
--------------------------------------------------------------------------------
--------------------------------------

Appel : ErreurCli(2,"ftp_chdir(): Requested file action okay, completed.","/home
/web/teliedi/appli/includes/classes/CRecipientFtp.php",341,array(true,CServeurFt
p))

Fichier : /home/web/teliedi/appli/includes/classes/CRecipientFtp.php
Ligne : 341
Appel : ftp_chdir(RESOURCE,"TOUR_XML")

//----------------------------------------------------------------

It is surprising to obtain a warning but the message is "Requested file action okay, completed."

The version is latest debian package for wheezy but more ancient than 5.4.17
root@wheezyDEVLaurent:~# php --version
PHP 5.4.4-14+deb7u3 (cli) (built: Jul 17 2013 14:54:08)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

I have no idea how to reproduce this bug and I don't know if it has been already corrected. I think a code analysis of ftp_chdir is needed to find in which case one can throw a warning with this message.

Let me know if I can help further.

Best regards,
   Laurent Lyaudet






Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-08 13:10 UTC] felipe@php.net
-Status: Open +Status: Feedback
 [2013-09-08 13:10 UTC] felipe@php.net
Do you know what ftp server are you trying connect to?
 [2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2014-01-26 18:33 UTC] Laurent dot Lyaudet at gmail dot com
Hi,

Sorry for the late answer but I requested in vain the information on the ftp server even before you asked for it the 2013-09-08. Until now I asked for it 4-5 times to the partner company we work with but I never obtained the answer. My contact just told me that it was a ftp server on an unix server (not really useful).
I wonder if it may be that the ftp server reply contains an error code but provides the message "Requested file action okay, completed."
If not then the bug is in PHP no matter what the ftp server is.
In both cases, I think it would be useful for PHP to provide the ftp reply code in any ftp related warning or error message.

Best regards,
  Laurent Lyaudet

PS : I get the following
ERROR:
    You aren't allowed to change a bug to that state.
when I want to reopen the bug.
 [2014-01-26 18:42 UTC] felipe@php.net
-Status: No Feedback +Status: Open
 [2014-01-29 12:15 UTC] cagnulein at gmail dot com
I've seen the same bug on Windows 8 64bit with PHP ver. 5.4.24
 [2014-03-20 21:42 UTC] Laurent dot Lyaudet at gmail dot com
Hi,

I encountered a similar bug with PHP 5.4.22-1~dotdeb.1 
This time the warning was with the following message:
ftp_chdir(): Closing data connection, ASCII transfer complete.
This corresponds to reply code 226 which is not an error code.

Best regards,
   Laurent Lyaudet
 [2018-03-19 15:31 UTC] cmb@php.net
> It is surprising to obtain a warning but the message is
> "Requested file action okay, completed."

The warning is issued if ftp_chdir() fails[1], which is not
supposed to happen if the reply code is 250[2] (which is
"Requested file action okay, completed.").  Either the FTP server
is broken, or our parsing of the response code[3] is too strict.

> ftp_chdir(): Closing data connection, ASCII transfer complete.
> This corresponds to reply code 226 which is not an error code.

According to RFC 959, the only valid success reply code for the
CWD command is 250[4], and it seems that non of the RFC's which
update 959 has added to this.  Therefore the FTP server would have
sent an erroneous reply.

[1] <https://github.com/php/php-src/blob/PHP-7.2.4/ext/ftp/php_ftp.c#L533-L536>
[2] <https://github.com/php/php-src/blob/PHP-7.2.4/ext/ftp/ftp.c#L531>
[3] <https://github.com/php/php-src/blob/PHP-7.2.4/ext/ftp/ftp.c#L1356>
[4] <https://tools.ietf.org/html/rfc959#page-49>
 [2018-05-24 22:44 UTC] chris dot lloyd at rezare dot co dot nz
I'm also getting a similar problem:

PHP Version: 5.6.4

The following messages indicate success, but they return as failures:
    ftp_put(): Ok to send data.
    ftp_chdir(): Directory successfully changed.
    ftp_put(): Transfer complete.

I often find retrying (typically 2 or 3 times, but can be 5+ times) returns true for success.
 [2021-08-04 14:15 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-08-04 14:15 UTC] cmb@php.net
Is this still an issue with any of the actively supported PHP
versions[1]?  Particularly fixing of bug #79100 (PHP 7.4.20 and
8.0.7, respectively) might be relevant here.

[1] <https://www.php.net/supported-versions.php>
 [2021-08-15 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 08:01:29 2024 UTC