bug62017.phpt 876 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Bug #62017: datefmt_create with incorrectly encoded timezone leaks pattern
  3. --EXTENSIONS--
  4. intl
  5. --FILE--
  6. <?php
  7. ini_set('intl.error_level', E_WARNING);
  8. var_dump(
  9. datefmt_create('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "\xFF",
  10. IntlDateFormatter::GREGORIAN, 'a'));
  11. try {
  12. var_dump(
  13. new IntlDateFormatter('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "Europe/Lisbon",
  14. IntlDateFormatter::GREGORIAN, "\x80"));
  15. } catch (IntlException $e) {
  16. echo PHP_EOL."Exception: " . $e->getMessage() . " in " . $e->getFile() . " on line " . $e->getLine() . PHP_EOL;
  17. }
  18. ?>
  19. --EXPECTF--
  20. Warning: datefmt_create(): datefmt_create: Time zone identifier given is not a valid UTF-8 string in %s on line %d
  21. NULL
  22. Exception: IntlDateFormatter::__construct(): datefmt_create: error converting pattern to UTF-16 in %sbug62017.php on line %d