bug62017.phpt 751 B

12345678910111213141516171819202122
  1. --TEST--
  2. Bug #62017: datefmt_create with incorrectly encoded timezone leaks pattern
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('intl'))
  6. die('skip intl extension not enabled');
  7. --FILE--
  8. <?php
  9. ini_set('intl.error_level', E_WARNING);
  10. var_dump(
  11. datefmt_create('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "\xFF",
  12. IntlDateFormatter::GREGORIAN, 'a'));
  13. var_dump(
  14. new IntlDateFormatter('', IntlDateFormatter::NONE, IntlDateFormatter::NONE, "Europe/Lisbon",
  15. IntlDateFormatter::GREGORIAN, "\x80"));
  16. --EXPECTF--
  17. Warning: datefmt_create(): datefmt_create: Time zone identifier given is not a valid UTF-8 string in %s on line %d
  18. NULL
  19. Warning: IntlDateFormatter::__construct(): datefmt_create: error converting pattern to UTF-16 in %s on line %d
  20. NULL