From:             glavic at gmail dot com
Operating system: ALL
PHP version:      Irrelevant
Package:          Date/time related
Bug Type:         Bug
Bug description:DatePeriod doesn't accept valid ISO-8601 formats (timezone 
problem)

Description:
------------
The ISO-8601 states the following: "The offset from UTC is given in the
format ±[hh]:[mm], ±[hh][mm], or ±[hh].". But DatePeriod accepts only
$iso formats that are in UTC (flag Z). See test script.

I have tried all possible combinations to set timezone correctly, but no
success:
http://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators

Test script:
---------------
<?php
$iso = 'R2/2013-09-09T12:00:15Z/P1D';
$periods = new DatePeriod($iso);
var_dump( is_object($periods) );

$iso = 'R2/2013-09-09T12:00:15+02:00/P1D';
$periods = new DatePeriod($iso);
var_dump( is_object($periods) );



Run this on multiple PHP versions: http://3v4l.org/b4n9j

Expected result:
----------------
bool(true)

bool(true) # with correct offset ofc

Actual result:
--------------
bool(true) 

Fatal error: Uncaught exception 'Exception' with message
'DatePeriod::__construct(): Unknown or bad format
(R2/2013-09-09T12:00:15+02:00/P1D)' in ...

-- 
Edit bug report at https://bugs.php.net/bug.php?id=65657&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65657&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65657&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65657&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65657&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65657&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65657&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65657&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65657&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65657&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65657&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65657&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65657&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65657&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65657&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65657&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65657&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65657&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65657&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65657&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65657&r=mysqlcfg

Reply via email to