|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33362 ftp_mdtm does not return correct date
Submitted: 2005-06-16 14:39 UTC Modified: 2005-06-16 19:41 UTC
From: till at klimpong dot com Assigned:
Status: Not a bug Package: FTP related
PHP Version: 4.3.10 OS: FreeBSD 5.2-current
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.
Block user comment
Status: Assign to:
Bug Type:
From: till at klimpong dot com
New email:
PHP Version: OS:


 [2005-06-16 14:39 UTC] till at klimpong dot com
ftp_mdtm always returns a wrong unix timestamp.

Our FTPd is proftpd (with TimesGMT off). The date, time and timezone are set correctly on the server.

When I connect to the FTP with another client (such as filezilla), all dates are displayed correct. This error only occurs within a PHP script.

For example:
current time on the server: 2:24PM
current time returned by ftp_mdtm: 4:24 PM

This example works:

echo strftime("%d.%m.%Y - %H:%M");

Displays the correct time, so I guess this problem comes from ftp_mtdm().

Reproduce code:
$file = '';
$ts = file_mtdm($file);
echo strftime("%d.%m.%Y - %H:%M", $ts);

Expected result:
File's modification time.

Actual result:
The file's modification time plus two hours.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-16 14:42 UTC] till at klimpong dot com
Forgot to add. I also set the locale on my system. Just to make sure that this is not some weird conversion bug.

setlocale(LC_ALL, 'de_DE.ISO8859-1');
 [2005-06-16 18:10 UTC]
Yes, because your time is GMT+2.

 [2005-06-16 18:19 UTC] till at klimpong dot com
Well, the server's time is set to GMT+2 already. The server is in my timezone and so on. So my local time and the server's time are the same.

If the server is GMT+2, then the function returns it with GMT+4. Where does the difference come from then?
 [2005-06-16 18:29 UTC]
Check what MDTM command gives you for that file in question
using your ftp client:

> debug
> modtime yourfile

 [2005-06-16 18:46 UTC] till at klimpong dot com
Command:  MDTM apache-ssl.txt
Response: 213 20050616141816

Which is correct.

ftp_mdtm on the same file returns 11189314961
 [2005-06-16 18:55 UTC]
You have extra '1' in the timestamp. (typo, I hope :)

# php -r 'echo gmdate("F d Y H:i:s", 1118931496);'
June 16 2005 14:18:16

That looks pretty okay to me.

 [2005-06-16 19:18 UTC] till at klimpong dot com
Typo indeed.

So I substituted strftime with gmdate and it works.

Thanks for your help.
 [2005-06-16 19:41 UTC]
It works -> no bug.
 [2013-09-09 16:14 UTC]
Automatic comment from SVN on behalf of daverandom
Log: Clarify the mechanism of prepared statements in MySQLi quickstart

Provided by anonymous #33362 on PHDOE
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri May 27 12:07:03 2022 UTC