bug67308.phpt 826 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. Bug #67308 (Serialize of DateTime truncates fractions of second)
  3. --INI--
  4. date.timezone=America/Vancouver
  5. --FILE--
  6. <?php
  7. // Ensure we can still unserialize the old style.
  8. var_dump(unserialize('O:8:"DateTime":3:{s:4:"date";s:19:"2005-07-14 22:30:41";s:13:"timezone_type";i:3;s:8:"timezone";s:13:"Europe/London";}'));
  9. // New style.
  10. var_dump(unserialize('O:8:"DateTime":3:{s:4:"date";s:26:"2005-07-14 22:30:41.123456";s:13:"timezone_type";i:3;s:8:"timezone";s:13:"Europe/London";}'));
  11. ?>
  12. --EXPECTF--
  13. object(DateTime)#%d (3) {
  14. ["date"]=>
  15. string(26) "2005-07-14 22:30:41.000000"
  16. ["timezone_type"]=>
  17. int(3)
  18. ["timezone"]=>
  19. string(13) "Europe/London"
  20. }
  21. object(DateTime)#%d (3) {
  22. ["date"]=>
  23. string(26) "2005-07-14 22:30:41.123456"
  24. ["timezone_type"]=>
  25. int(3)
  26. ["timezone"]=>
  27. string(13) "Europe/London"
  28. }