1--TEST-- 2IntlDateFormatter::parse update its calendar 3--EXTENSIONS-- 4intl 5--FILE-- 6<?php 7$oIntlDateFormatter = new IntlDateFormatter("en_GB"); 8$oIntlDateFormatter->setTimeZone('Europe/Berlin'); 9$oIntlDateFormatter->setPattern('VV'); 10 11var_dump($oIntlDateFormatter->parse('America/Los_Angeles', $offset1)); 12var_dump($oIntlDateFormatter->getTimeZone()->getID()); 13var_dump($oIntlDateFormatter->parseToCalendar('America/Los_Angeles', $offset2)); 14var_dump($oIntlDateFormatter->getTimeZone()->getID()); 15$offset3 = "offset"; 16 17try { 18 $oIntlDateFormatter->parseToCalendar('America/Los_Angeles', $offset3); 19} catch (\TypeError $e) { 20 echo $e->getMessage() . PHP_EOL; 21} 22$offset3 = PHP_INT_MAX * 16; 23try { 24 $oIntlDateFormatter->parseToCalendar('America/Los_Angeles', $offset3); 25} catch (\ValueError $e) { 26 echo $e->getMessage(); 27} 28--EXPECTF-- 29int(%d) 30string(13) "Europe/Berlin" 31int(%d) 32string(19) "America/Los_Angeles" 33IntlDateFormatter::parseToCalendar(): Argument #2 ($offset) must be of type int, string given 34 35Deprecated: Implicit conversion from float %r(1\.4757395258967641E\+20|34359738352)%r to int loses precision in %s on line %d 36