Skip to content

Since PHP 8.1.7 strtotime translates a date-time with DST/non-DST hour differently based on default timezone #9165

Closed
@ashiful-kyos

Description

@ashiful-kyos

Description

For the timezone Europe/London on date 2018-10-28 two hour 01:00:00 exist - one DST and another non-DST. Following code shows that it gives two different timestamp based on the set default timezone. Which should not be the case as the string date-time provided to strtotime already contains the timezone.
Prior to PHP 8.1.7 strtotime was translating it into 1540688400 regardless set timezone.

<?php
date_default_timezone_set('America/Lower_Princes');
echo strtotime("2018-10-28 01:00:00 Europe/London") . PHP_EOL;

date_default_timezone_set('Europe/London');
echo strtotime("2018-10-28 01:00:00 Europe/London"). PHP_EOL;

Resulted in this output:

1540688400
1540684800

But I expected this output instead:

1540688400
1540688400

PHP Version

PHP 8.1.7

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions