php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68197 BST to GMT conversion does not appear to be applied at the correct time
Submitted: 2014-10-09 12:00 UTC Modified: 2014-10-10 07:11 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: Octuro at gmail dot com Assigned:
Status: Closed Package: date_time (PECL)
PHP Version: 5.5.9 OS: Ubuntu14.04
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.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Octuro at gmail dot com
New email:
PHP Version: OS:

 

 [2014-10-09 12:00 UTC] Octuro at gmail dot com
Description:
------------
Appears that the BST to GMT switch is not been applied correctly

Test script:
---------------
<?php
$objDateTime = new \DateTime("26 October 2014 00:15:00 +0000");
$objDateTime->setTimeZone(new \DateTimeZone('UTC'));
var_dump($objDateTime);
var_dump($objDateTime->getOffSet());
var_dump($objDateTime->getTimeStamp());
var_dump($objDateTime->format("d F Y H:i:s O"));

$objDateTime->setTimeZone(new \DateTimeZone('Europe/London'));
var_dump($objDateTime);
var_dump($objDateTime->getTimeStamp());
var_dump($objDateTime->format("d F Y H:i:s O"));
var_dump($objDateTime->getOffSet());

Expected result:
----------------
string(30) "26 October 2014 00:15:00 +0000"
string(30) "26 October 2014 01:15:00 +0100"

Actual result:
--------------
string(30) "26 October 2014 00:15:00 +0000"
string(30) "26 October 2014 01:15:00 +0000"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-09 12:03 UTC] Octuro at gmail dot com
-Package: timezonedb +Package: date_time
 [2014-10-09 12:03 UTC] Octuro at gmail dot com
I think that date_time is actually more accurate
 [2014-10-09 13:07 UTC] derick@php.net
I can not reproduce this with PHP 5.5.17 - you filled in "Irrelevant" for PHP version, which is not helpful. In any case, for me, this outputs (after removing your extra var_dumps):

derick@whisky:~ $ php /tmp/test.php
string(30) "26 October 2014 00:15:00 +0000"
string(30) "26 October 2014 01:15:00 +0100"
[PHP: 5.5.17-dev  ]
derick@whisky:~ $ php -v
PHP 5.5.17-dev (cli) (built: Sep 22 2014 16:35:00) (DEBUG)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Xdebug v2.3.0dev, Copyright (c) 2002-2013, by Derick Rethans
derick@whisky:~ $ cat /tmp/test.php 
<?php
$objDateTime = new \DateTime("26 October 2014 00:15:00 +0000");
$objDateTime->setTimeZone(new \DateTimeZone('UTC'));
var_dump($objDateTime->format("d F Y H:i:s O"));

$objDateTime->setTimeZone(new \DateTimeZone('Europe/London'));
var_dump($objDateTime->format("d F Y H:i:s O"));
 [2014-10-09 13:07 UTC] derick@php.net
-Status: Open +Status: Feedback
 [2014-10-09 13:07 UTC] derick@php.net
So, which PHP version is that?
 [2014-10-09 13:17 UTC] octuro at gmail dot com
Hi

There was no option in the drop down for my version.
I did not think of adding it to the comments.

Details are as follows:
PHP 5.3.10-1ubuntu3.14 with Suhosin-Patch (cli) (built: Sep  4 2014 07:08:49) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans
 [2014-10-09 13:39 UTC] Octuro at gmail dot com
-Status: Feedback +Status: Open -PHP Version: Irrelevant +PHP Version: 5.3.10
 [2014-10-09 13:39 UTC] Octuro at gmail dot com
updated version information
 [2014-10-09 14:10 UTC] derick@php.net
-Status: Open +Status: Wont fix
 [2014-10-09 14:10 UTC] derick@php.net
That version is way too old. PHP 5.3 is no longer maintained: http://php.net/archive/2014.php#id2014-08-14-1 and 5.3.*10* is 2½ years older than the latest 5.3. release. Please upgrade first.
 [2014-10-09 15:46 UTC] Octuro at gmail dot com
-Operating System: Ubuntu12.04 +Operating System: Ubuntu14.04 -PHP Version: 5.3.10 +PHP Version: 5.5.9
 [2014-10-09 15:46 UTC] Octuro at gmail dot com
Hi Derick

Testing your script on my machine works as expected and the bug is not there.
It appears the getTimeStamp causes the issue.

Revised script that needs to be run:
$objDateTime = new \DateTime("26 October 2014 00:15:00 +0000");
$objDateTime->setTimeZone(new \DateTimeZone('UTC'));
var_dump($objDateTime->format("d F Y H:i:s O"));

$objDateTime->setTimeZone(new \DateTimeZone('Europe/London'));
var_dump($objDateTime->getTimeStamp());
var_dump($objDateTime->format("d F Y H:i:s O"));

This has also been tested on the following configuration, and the bug persists:

PHP 5.5.9-1ubuntu4.4 (cli) (built: Sep  4 2014 06:56:34) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
   with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"

Updating the PHP version and ubuntu version.
 [2014-10-09 16:09 UTC] pajoye@php.net
Besides what Derick said, it has nothing to do with this package. As I can't change it to the core's date category, I am closing it.
 [2014-10-10 07:11 UTC] Octuro at gmail dot com
-Status: Wont fix +Status: Closed
 [2014-10-10 07:11 UTC] Octuro at gmail dot com
created with correct category as requested https://bugs.php.net/bug.php?id=68204
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Oct 08 04:01:28 2024 UTC