bug35499.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. --TEST--
  2. Bug #35499 (strtotime() does not handle whitespace around the date string)
  3. --FILE--
  4. <?php
  5. date_default_timezone_set("UTC");
  6. echo date(DATE_ISO8601, strtotime("11/20/2005 8:00 AM \r\n")) . "\n";
  7. echo date(DATE_ISO8601, strtotime(" 11/20/2005 8:00 AM \r\n")) . "\n";
  8. var_dump(date_parse(" a "));
  9. var_dump(date_parse(" \n "));
  10. ?>
  11. --EXPECT--
  12. 2005-11-20T08:00:00+0000
  13. 2005-11-20T08:00:00+0000
  14. array(16) {
  15. ["year"]=>
  16. bool(false)
  17. ["month"]=>
  18. bool(false)
  19. ["day"]=>
  20. bool(false)
  21. ["hour"]=>
  22. bool(false)
  23. ["minute"]=>
  24. bool(false)
  25. ["second"]=>
  26. bool(false)
  27. ["fraction"]=>
  28. bool(false)
  29. ["warning_count"]=>
  30. int(0)
  31. ["warnings"]=>
  32. array(0) {
  33. }
  34. ["error_count"]=>
  35. int(0)
  36. ["errors"]=>
  37. array(0) {
  38. }
  39. ["is_localtime"]=>
  40. bool(true)
  41. ["zone_type"]=>
  42. int(2)
  43. ["zone"]=>
  44. int(3600)
  45. ["is_dst"]=>
  46. bool(false)
  47. ["tz_abbr"]=>
  48. string(1) "A"
  49. }
  50. array(12) {
  51. ["year"]=>
  52. bool(false)
  53. ["month"]=>
  54. bool(false)
  55. ["day"]=>
  56. bool(false)
  57. ["hour"]=>
  58. bool(false)
  59. ["minute"]=>
  60. bool(false)
  61. ["second"]=>
  62. bool(false)
  63. ["fraction"]=>
  64. bool(false)
  65. ["warning_count"]=>
  66. int(0)
  67. ["warnings"]=>
  68. array(0) {
  69. }
  70. ["error_count"]=>
  71. int(0)
  72. ["errors"]=>
  73. array(0) {
  74. }
  75. ["is_localtime"]=>
  76. bool(false)
  77. }