PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Php 5 and DST - touch not working
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Php 5 and DST - touch not working

Réponse
 
LinkBack Outils de la discussion
Vieux 28/03/2008, 06h13   #1
Chuck Anderson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Php 5 and DST - touch not working

I've got a script that "syncs" files from my working hard drive (Windows
XP) to a backup drive based on filesize and filemtime. It's never had
problems at the DST switch before, but since upgrading to Php5, it seems
like Php is confused (is certainly confusing me) as to what time zone to
use. I am in Denver and I have set the default timezone to
"America/Denver" in php.ini (... would much prefer using numbers like
-0700 or -0600). The current time zone in Windows is MDT (which is
-0600). Php5 - date('O') - also tells me it is -0600 (or date ('T')
says - MDT).

When I touch the dest file (backup on H:/) with the timestamp of the
source file (on C:/), it does not change.
The timestamp of the dest file (backup) stays what it had previously been.

In other words. My initial scan shows (filemtime date - timestamp)
C:/file1.php - fmtime = 02/25/2007 22:34:26 - 1172468066 – size = 614
H:/file1.php - fmtime = 02/25/2007 21:34:26 - 1172464466 – size = 614

If I: touch ('H:/file1.php', 1172468066); // touch returns boolean TRUE

and I scan again I get the same results:
C:/file1.php - fmtime = 02/25/2007 22:34:26 - 1172468066 – size = 614
H:/file1.php - fmtime = 02/25/2007 21:34:26 - 1172464466 – size = 614

The file time of the copy on H:/ is unchanged. - ???

If I go back and run Php4, the file time does update.

Wot's uh the deal ...... why is Php5 "misbehaving?"

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
***********************************

  Réponse avec citation
Vieux 28/03/2008, 13h10   #2
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Php 5 and DST - touch not working

Chuck Anderson wrote:
> I've got a script that "syncs" files from my working hard drive (Windows
> XP) to a backup drive based on filesize and filemtime. It's never had
> problems at the DST switch before, but since upgrading to Php5, it seems
> like Php is confused (is certainly confusing me) as to what time zone to
> use. I am in Denver and I have set the default timezone to
> "America/Denver" in php.ini (... would much prefer using numbers like
> -0700 or -0600). The current time zone in Windows is MDT (which is
> -0600). Php5 - date('O') - also tells me it is -0600 (or date ('T')
> says - MDT).
>
> When I touch the dest file (backup on H:/) with the timestamp of the
> source file (on C:/), it does not change. The timestamp of the dest file
> (backup) stays what it had previously been.
>
> In other words. My initial scan shows (filemtime date - timestamp)
> C:/file1.php - fmtime = 02/25/2007 22:34:26 - 1172468066 – size = 614
> H:/file1.php - fmtime = 02/25/2007 21:34:26 - 1172464466 – size = 614
>
> If I: touch ('H:/file1.php', 1172468066); // touch returns boolean TRUE
>
> and I scan again I get the same results:
> C:/file1.php - fmtime = 02/25/2007 22:34:26 - 1172468066 – size = 614
> H:/file1.php - fmtime = 02/25/2007 21:34:26 - 1172464466 – size = 614
>
> The file time of the copy on H:/ is unchanged. - ???
>
> If I go back and run Php4, the file time does update.
> Wot's uh the deal ...... why is Php5 "misbehaving?"
>


Yep, see http://bugs.php.net/bug.php?id=40568. Looks like it isn't
going to be fixed, however. I suggest you add your input to the bug
report. The more who do the more pressure it puts on them to fix it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 28/03/2008, 15h11   #3
Alexey Kulentsov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Php 5 and DST - touch not working

Chuck Anderson wrote:

> The file time of the copy on H:/ is unchanged. - ???


Did you try clearstatcache() before getting timestamp second time?
  Réponse avec citation
Vieux 28/03/2008, 20h21   #4
Chuck Anderson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Php 5 and DST - touch not working

Alexey Kulentsov wrote:
> Chuck Anderson wrote:
>
>
>> The file time of the copy on H:/ is unchanged. - ???
>>

>
> Did you try clearstatcache() before getting timestamp second time?
>


Like this?

$dest = 'H:/file1.php';
if (!touch($dest, 1172464466)) echo 'touch failed' ;
clearstatcache();
echo filemtime($dest);
// output = 1172460866 (one hour less ... how maddening)

So ... yes (thanks).

As Jerry pointed out, there is a bug report showing this behavior was
introduced in Php 5.2.1 (in Windows32).
http://bugs.php.net/bug.php?id=40568 And the bug report status is
simply ... suspended. My only resort to keep my backup scripts working
properly was to revert back to Php 4 (or manually copy the backups in
Windows Explorer). I don't see why this bug is being ignored. (And
I've little faith that my "one" vote will affect that status). There is
no work around. I'll have to keep an earlier version of Php to run
twice every year (at the time changes) - or add a switch in my script
that will add or subtract one hour from the desired timestamp.

--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
Nothing he's got he really needs
Twenty first century schizoid man.
***********************************

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 18h16.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11451 seconds with 12 queries