php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33552 Modification Date
Submitted: 2005-07-03 08:39 UTC Modified: 2005-07-04 01:09 UTC
From: badocs at tbaytel dot net Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.10 OS: Linux
Private report: No CVE-ID: None
 [2005-07-03 08:39 UTC] badocs at tbaytel dot net
Description:
------------
I've noticed a very annoying bug.

I use a upload script with php to allow clients to upload their own web pages. My intent was to have a table on the front page displaying the most recently modified site. I do this by scanning the toplevel directory for their usernames.

ie)
user1/
user2/

...And i find the most recently modified file and use that, compare that date to other sites and generate a sorted list of sites. This was also to be used for inactivity with accounts, so that a website that wasn't being updated after a bit..would alert me to think about removing it to save space.

Unfortunely, php does not set the file modification date when the file is uploaded, and i've tried chmod() and touch() to attempt to correct that by setting a date to no avail. I'm wondering how I can set the modified date. I must be a noob if i'm not getting this correct.

Reproduce code:
---------------
// The code to automatically set the modification date, since php won't automatically.
// so we upload a file to ($path . "/" . $filename), path is where the file is to be uploaded to..

//now to manually set the damn modified time.
$newfile = "$path/$filename";
echo $newfile; // looks correct
chmod ($l, 0777); // set write.
touch ($l); // if i put this in a if state, it says it worked...but it didn't.

// so far, no matter what, any file uploaded has the date of December 31 1969 18:00:00.

Expected result:
----------------
So, the one thing i could see as my screwup would be offering touch its second argument, but the docs said that touch would auto-do it......

Other then that....I'm lost..and it's very annoying.

Can someone please offer a solution that sets the damned modification date....with just php...because i'm under hosting and i don't know if i have access to the ftp stuff with php that would probably solve this problem in a alternate way...

OR...

does anyone know the function(s) that will display the creation date...and if php even writes that on upload...


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-03 22:13 UTC] tony2001@php.net
I can't say I fully understand your explanation, but I still  do not see any sense in reporting a problem that could be already fixed.
I'd really appreciate if you provide a _short_ test case *and* test it with latest snapshot of PHP4 (also I'd be very thankful if you give a try to latest snapshot of PHP5 too).
Thanks in advance.
 [2005-07-03 22:53 UTC] badocs at tbaytel dot net
I am not the admin of the server, so i cannot do anything to my version of php.

I would test it out on a later version...but I looked and the problem has never been brought up before...so it doesn't seem that major. But the solution works, it's just logic really..write the date, get the date, sort the date.
 [2005-07-04 01:09 UTC] sniper@php.net
Ask the administrator of the server to report bugs.
And this works fine for me.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 00:01:34 2024 UTC