php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29451 getlastmod() returns access time - solution
Submitted: 2004-07-30 01:36 UTC Modified: 2004-08-23 19:16 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: robert at rw-it dot net Assigned:
Status: Wont fix Package: Apache related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: robert at rw-it dot net
New email:
PHP Version: OS:

 

 [2004-07-30 01:36 UTC] robert at rw-it dot net
Description:
------------
With some combinations of mod_php and Apache, getlastmod() returns the access time instead of the modification time.

All bug reports that deal with this seem to have been closed with "Works in CVS" or "Apache problem", both of which are not true.

The Problem occurs if Apache was built with large file size (64-bit) support and mod_php wasn't, so they are essentially using different stat(2) structures. If 64-bit file offsets are used, the st_blocks member of struct stat grows to 64 bits and pushes the time members 32 bits "upwards". If you access this structure as a 32-bit stat structure from mod_php, st_atime contains garbage, st_mtime the access time and st_ctime the modification time of the 64-bit structure (voila!).

The easy solution is to #define _FILE_OFFSET_BITS to 64, if Apache does (did) this.
The hard part is that I don't know how to figure out if Apache uses 32 or 64 bits after it is installed.
Secondly, PHP itself would have to use 64-bit stat structures, and I don't know if this might lead to more problems.
So maybe it's better to transform the stat structure in mod_php?

Any ideas?



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-23 19:16 UTC] iliaa@php.net
The problem is that normal (module) PHP build only involves 
Apache headers which do not appear to provide this 
information. Consequently PHP cannot perform the check you 
have mentioned. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 19:01:30 2024 UTC