Edit report at https://bugs.php.net/bug.php?id=64814&edit=1

 ID:                 64814
 User updated by:    marc at weistroff dot net
 Reported by:        marc at weistroff dot net
 Summary:            Nano precision is not supported while decoding RFC
                     3339 formatted date/times.
 Status:             Open
 Type:               Bug
 Package:            Date/time related
 PHP Version:        5.5.0RC1
 Block user comment: N
 Private report:     N

 New Comment:

I should have precise in the description of the bug that PHP returns an error 
when  
the number of digits in the "time-secfrac" part is > 8.


Previous Comments:
------------------------------------------------------------------------
[2013-05-10 17:29:15] marc at weistroff dot net

Description:
------------
While trying to parse a RFC3339 datetime, PHP will generate the error "The 
timezone could not be found in the database".

It can cause problems with other systems that produce such date/time strings.

As you can see on http://3v4l.org/Bl1Kv, it affects php from version 5.2.0 to 
5.5.0.

Test script:
---------------
<?php
date_default_timezone_set('UTC');
var_dump(date_parse("2006-12-12T10:00:00.999999999-04:00"));
?>

Expected result:
----------------
array(15) {
  ["year"]=>
  int(2006)
  ["month"]=>
  int(12)
  ["day"]=>
  int(12)
  ["hour"]=>
  int(10)
  ["minute"]=>
  int(0)
  ["second"]=>
  int(0)
  ["fraction"]=>
  float(0.999999999)
  ["warning_count"]=>
  int(0)
  ["warnings"]=>
  array(0) {
  }
  ["error_count"]=>
  int(0)
  ["errors"]=>
  array(0) {
  }
  ["is_localtime"]=>
  bool(true)
  ["zone_type"]=>
  int(1)
  ["zone"]=>
  int(240)
  ["is_dst"]=>
  bool(false)
}

Actual result:
--------------
array(13) {
  ["year"]=>
  int(2006)
  ["month"]=>
  int(12)
  ["day"]=>
  int(12)
  ["hour"]=>
  int(10)
  ["minute"]=>
  int(0)
  ["second"]=>
  int(0)
  ["fraction"]=>
  float(0.99999999)
  ["warning_count"]=>
  int(0)
  ["warnings"]=>
  array(0) {
  }
  ["error_count"]=>
  int(1)
  ["errors"]=>
  array(1) {
    [0]=>
    string(47) "The timezone could not be found in the database"
  }
  ["is_localtime"]=>
  bool(true)
  ["zone_type"]=>
  int(0)
}


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64814&edit=1

Reply via email to