Mantis - Quercus
Viewing Issue Advanced Details
5259 minor always 10-24-12 13:17 10-24-12 18:30
gbruins  
nam  
normal  
closed  
fixed  
none    
none  
0005259: strtotime returns null value on DST when given an ISO-8601 timestamp as an argument
For the "Europe/Luxembourg" timezone, DST occurs on March 25 at 2am.

If you pass in ISO-8601 timestamp *without a timezone offset* into strtotime(), a null value will be returned if the timestamp is for the DST time (2012-03-25T02:00:00):


date_default_timezone_set("Europe/Luxembourg");
echo "
1 am -> without offset: ".strtotime("2012-03-25T01:00:00").", with offset: ".strtotime("2012-03-25T01:00:00.000+01:00");

echo "
2 am -> without offset: ".strtotime("2012-03-25T02:00:00").", with offset: ".strtotime("2012-03-25T02:00:00.000+01:00");

echo "
3 am -> without offset: ".strtotime("2012-03-25T03:00:00").", with offset: ".strtotime("2012-03-25T03:00:00.000+01:00");



EXPECTED RESULT:
1 am -> without offset: 1332633600, with offset: 1332633600
2 am -> without offset: 1332637200, with offset: 1332637200
3 am -> without offset: 1332637200, with offset: 1332640800

ACTUAL RESULT:
1 am -> without offset: 1332633600, with offset: 1332633600
2 am -> without offset: , with offset: 1332637200
3 am -> without offset: 1332637200, with offset: 1332640800

Notes
(0006070)
nam   
10-24-12 18:30   
php/191u

Fixed for 4.0.33.

Quercus trunk was returning a timestamp instead of NULL. But it wasn't properly parsing the timezone. For that issue, I just fixed it.

<?php

date_default_timezone_set("Europe/Luxembourg");

var_dump(strtotime("2012-03-25T01:00:00"));
var_dump(strtotime("2012-03-25T01:00:00.000+01:00"));

echo "\n";
var_dump(strtotime("2012-03-25T02:00:00"));
var_dump(strtotime("2012-03-25T02:00:00.000+01:00"));

echo "\n";
var_dump(strtotime("2012-03-25T03:00:00"));
var_dump(strtotime("2012-03-25T03:00:00.000+01:00"));

?>

Results
---------------
int(1332633600)
int(1332633600)

int(1332637200)
int(1332637200)

int(1332637200)
int(1332640800)