[PHP-BUG] Bug #68871 [NEW]: strftime returns wrong timestamp with date_default_timezone_set
[email protected] ("ricky at ez2 dot us")
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
From: ricky at ez2 dot us
Operating system: Ubuntu 14.04 x64
PHP version: 5.5.20
Package: PHP Language Specification
Bug Type: Bug
Bug description:strftime returns wrong timestamp with date_default_timezone_set
Description:
------------
strftime with %s format returns wrong value.
Test script:
---------------
<?php
//php.ini date.timezone = Asia/Taipei (UTC +0800)
date_default_timezone_set('UTC');
$time = time();
$time2 = strftime('%s', $time);
if($time != $time2){
echo "something wrong";
}
else{
echo "nothing";
}
Expected result:
----------------
nothing
Actual result:
--------------
something wrong
--
Edit bug report at https://bugs.php.net/bug.php?id=68871&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68871&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68871&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68871&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68871&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68871&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68871&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68871&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68871&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68871&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68871&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68871&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68871&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68871&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68871&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68871&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68871&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68871&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68871&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68871&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68871&r=mysqlcfg