bug67118_2.phpt 726 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Regression introduce in fix for Bug #67118 - Invalid code
  3. --INI--
  4. date.timezone=Europe/Paris
  5. --FILE--
  6. <?php
  7. class Foo extends DateTime {
  8. public function __construct($time = null) {
  9. $tz = new DateTimeZone('UTC');
  10. try {
  11. echo "First try\n";
  12. parent::__construct($time, $tz);
  13. return;
  14. } catch (Exception $e) {
  15. echo "Second try\n";
  16. parent::__construct($time.'C', $tz);
  17. }
  18. }
  19. }
  20. $date = '12 Sep 2007 15:49:12 UT';
  21. var_dump(new Foo($date));
  22. ?>
  23. Done
  24. --EXPECT--
  25. First try
  26. Second try
  27. object(Foo)#1 (3) {
  28. ["date"]=>
  29. string(26) "2007-09-12 15:49:12.000000"
  30. ["timezone_type"]=>
  31. int(3)
  32. ["timezone"]=>
  33. string(3) "UTC"
  34. }
  35. Done