Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6842

Re: Does this indicate a bug in PHP?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!newsfeed.tele2net.at!newsfeed.utanet.at!feeder1.cambriumusenet.nl!feed.tweaknews.nl!193.141.40.65.MISMATCH!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail
Content-Type text/plain; charset="UTF-8"
Message-ID <1968307.IDv9frP7EL@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Reply-To Thomas 'PointedEars' Lahn <php@PointedEars.de>
Organization PointedEars Software (PES)
Date Sat, 25 Aug 2012 00:47:16 +0200
User-Agent KNode/4.4.11
Content-Transfer-Encoding 8Bit
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Subject Re: Does this indicate a bug in PHP?
Newsgroups comp.lang.php
References <20120824013610.b719e083.vlatko.surlan@evorion.hr>
Followup-To comp.lang.php
MIME-Version 1.0
Lines 75
NNTP-Posting-Date 25 Aug 2012 00:47:16 CEST
NNTP-Posting-Host c5f74511.newsspool3.arcor-online.net
X-Trace DXC=Q?OgT>c;Jh<U`5g[@c]@J1McF=Q^Z^V384Fo<]lROoR18kF<OcfhCO;GGYUYI]Zj9>DZm8W4\YJN<T<8F<]0D<`9hGKb_YP1>`9Q1D[@@=HWk7
X-Complaints-To usenet-abuse@arcor.de
Xref csiph.com comp.lang.php:6842

Followups directed to: comp.lang.php

Show key headers only | View raw


Vlatko Šurlan wrote:

> Pay attention to the different mtimes reported.
> 
> vlatko@david:/tmp/mtimeTests$ php5 -v
> PHP 5.3.3-7+squeeze14 with Suhosin-Patch (cli) (built: Aug  6 2012
> 20:08:59) Copyright (c) 1997-2009 The PHP Group
> Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
>     with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
>     with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
> 
> vlatko@david:/tmp/mtimeTests$ ll
> total 56
> -rw-r----- 1 vlatko vlatko 51946 Kol 23 19:01 img.jpg

`stat img.jpg', which shows the milliseconds, would have been more helpful 
for diagnostics.

> vlatko@david:/tmp/mtimeTests$ php5 -r 'echo filemtime("img.jpg") . "\n";'
> ****1345741275****
> 
> vlatko@david:/tmp/mtimeTests$ php5 -r '$zip = new ZipArchive();
> $zip->open("test.zip", ZIPARCHIVE::CREATE); $zip->addFile("img.jpg");
> $zip->close();'
> 
> vlatko@david:/tmp/mtimeTests$ php5 -r '$zip = new ZipArchive();
> $zip->open("test.zip"); print_r($zip->statIndex(0));'
> [snip]
>     [mtime] => ****1345741274****
> [snip]
> 
> vlatko@david:/tmp/mtimeTests$ zip update test.zip
>   adding: test.zip (stored 0%)

This adds test.zip to the ZIP archive `update.zip'.  It has nothing to do 
with the *mtime* of test.zip or the files in test.zip.

> vlatko@david:/tmp/mtimeTests$ php5 -r '$zip = new ZipArchive();
> $zip->open("test.zip"); print_r($zip->statIndex(0));'
> [snip]
>     [mtime] => ****1345741274****
> [snip]
>  
> I detected this while trying to update a ZIP archive using PHP. Obviously
> I tried to compare filemtime for each file with what ZipArchive reported
> and realized that they are never the same. What is going on here?

$ stat -c %Y test.txt
1270260799

$ php5 -r 'echo filemtime("test.txt") . "\n";'
1270260799

$ php5 -r '$zip = new ZipArchive(); $zip->open("test.zip", 
ZIPARCHIVE::CREATE); $zip->addFile("test.txt"); $zip->close();'

$ php5 -r '$zip = new ZipArchive(); $zip->open("test.zip"); print_r($zip-
>statIndex(0));' | grep mtime
    [mtime] => 1270260798

$ php5 --version
PHP 5.3.10-1 (cli) (built: Feb  3 2012 10:03:01) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with XCache v1.3.2, Copyright (c) 2005-2011, by mOo
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
    with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

The mtime with ZipArchive is behind by only one second after epoch.  This 
might be caused by that mtime not taking into account UTC's leap seconds.
 

PointedEars
-- 
When all you know is jQuery, every problem looks $(olvable).

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Does this indicate a bug in PHP? Vlatko Šurlan <vlatko.surlan@evorion.hr> - 2012-08-24 01:36 +0200
  Re: Does this indicate a bug in PHP? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-08-25 00:47 +0200

csiph-web