com php-src: Let MessageFormatter and IntlDateFormatter accept DateTimeImmutable as well: NEWS ext/intl/common/common_date .cpp
ext/intl/tests/dateformat_bug65683.phpt ext/intl/tests/dateformat_format.phpt ext/intl/tests/d ateformat_format_variant2.phpt ext/intl/tests/datefor
mat_format_variant3.phpt ext/intl/tests/msgfmt_form at_datetime.phpt ext/intl/tests/msgfmt_format_error 5.phpt
| From: | Nikita Popov | Date: | Tue, 28 Mar 2017 22:20:46 +0000 |
| Subject: | com php-src: Let MessageFormatter and IntlDateFormatter accept DateTimeImmutable as well: NEWS ext/intl/common/common_date .cpp ext/intl/tests/dateformat_bug65683.phpt ext/intl/tests/dateformat_format.phpt ext/intl/tests/d ateformat_format_variant2.phpt ext/intl/tests/datefor mat_format_variant3.phpt ext/intl/tests/msgfmt_form at_datetime.phpt ext/intl/tests/msgfmt_format_error 5.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-97430@lists.php.net to get a copy of this message | ||
Commit: d896878ad592335ee094f531f56673178dc2b301
Author: Ben Scholzen <mail@dasprids.de> Mon, 27 Mar 2017 19:47:14 +0200
Committer: Nikita Popov <nikita.ppv@gmail.com> Wed, 29 Mar 2017 00:20:46 +0200
Parents: d2bae4ecad0271bba4a0d8e57c0b93ee847a6344
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d896878ad592335ee094f531f56673178dc2b301
Log:
Let MessageFormatter and IntlDateFormatter accept DateTimeImmutable as well
Changed paths:
M NEWS
M ext/intl/common/common_date.cpp
A ext/intl/tests/dateformat_bug65683.phpt
M ext/intl/tests/dateformat_format.phpt
M ext/intl/tests/dateformat_format_variant2.phpt
M ext/intl/tests/dateformat_format_variant3.phpt
M ext/intl/tests/msgfmt_format_datetime.phpt
M ext/intl/tests/msgfmt_format_error5.phpt
diff --git a/NEWS b/NEWS index 73aa8c3..97f07e1 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2017, PHP 7.1.5 - +- Intl: + . Fixed bug #65683 (Intl does not support DateTimeImmutable). (Ben Scholzen) 13 Apr 2017, PHP 7.1.4 diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp index f1bf75a..98c6393 100644 --- a/ext/intl/common/common_date.cpp +++ b/ext/intl/common/common_date.cpp @@ -145,8 +145,8 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, php_date_obj *datetime; datetime = Z_PHPDATE_P(z); if (!datetime->time) { - spprintf(&message, 0, "%s: the DateTime object is not properly " - "initialized", func); + spprintf(&message, 0, "%s: the %s object is not properly " + "initialized", func, ZSTR_VAL(Z_OBJCE_P(z)->name)); intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1); efree(message); @@ -205,7 +205,7 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func) rv = U_MILLIS_PER_SECOND * Z_DVAL_P(z); break; case IS_OBJECT: - if (instanceof_function(Z_OBJCE_P(z), php_date_get_date_ce())) { + if (instanceof_function(Z_OBJCE_P(z), php_date_get_interface_ce())) { intl_datetime_decompose(z, &rv, NULL, err, func); } else if (instanceof_function(Z_OBJCE_P(z), Calendar_ce_ptr)) { Calendar_object *co = Z_INTL_CALENDAR_P(z); @@ -228,7 +228,7 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func) } else { /* TODO: try with cast(), get() to obtain a number */ spprintf(&message, 0, "%s: invalid object type for date/time " - "(only IntlCalendar and DateTime permitted)", func); + "(only IntlCalendar and DateTimeInterface permitted)", func); intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1); efree(message); diff --git a/ext/intl/tests/dateformat_bug65683.phpt b/ext/intl/tests/dateformat_bug65683.phpt new file mode 100644 index 0000000..d18cb4c --- /dev/null +++ b/ext/intl/tests/dateformat_bug65683.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #65683 IntlDateFormatter accepts DateTimeImmutable +--SKIPIF-- +<?php +if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> +--FILE-- +<?php + +$formatter = new IntlDateFormatter('en-US', IntlDateFormatter::FULL, IntlDateFormatter::NONE, new DateTimeZone("UTC")); +var_dump($formatter->format(new DateTimeImmutable('2017-03-27 00:00:00 UTC'))) . "\n"; + +?> +==DONE== +--EXPECTF-- +string(%s) "Monday, March %d, 2017" +==DONE== diff --git a/ext/intl/tests/dateformat_format.phpt b/ext/intl/tests/dateformat_format.phpt index 241c5f9..a0135a8 100644 --- a/ext/intl/tests/dateformat_format.phpt +++ b/ext/intl/tests/dateformat_format.phpt @@ -400,24 +400,24 @@ Formatted DateTime is : 20001230 05:04 PM Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' diff --git a/ext/intl/tests/dateformat_format_variant2.phpt b/ext/intl/tests/dateformat_format_variant2.phpt index 07c67e9..a3df39a 100644 --- a/ext/intl/tests/dateformat_format_variant2.phpt +++ b/ext/intl/tests/dateformat_format_variant2.phpt @@ -400,24 +400,24 @@ Formatted DateTime is : 20001230 05:04 PM Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' diff --git a/ext/intl/tests/dateformat_format_variant3.phpt b/ext/intl/tests/dateformat_format_variant3.phpt index d770473..da0d662 100644 --- a/ext/intl/tests/dateformat_format_variant3.phpt +++ b/ext/intl/tests/dateformat_format_variant3.phpt @@ -400,24 +400,24 @@ Formatted DateTime is : 20001230 05:04 PM Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' diff --git a/ext/intl/tests/msgfmt_format_datetime.phpt b/ext/intl/tests/msgfmt_format_datetime.phpt index 07e7d68..bf0d24b 100644 --- a/ext/intl/tests/msgfmt_format_datetime.phpt +++ b/ext/intl/tests/msgfmt_format_datetime.phpt @@ -16,13 +16,16 @@ $fmt = <<<EOD EOD; $dt = new DateTime("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon")); +$dti = new DateTimeImmutable("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon")); $mf = new MessageFormatter('en_US', $fmt); var_dump($mf->format(array($dt))); +var_dump($mf->format(array($dti))); ?> ==DONE== --EXPECTF-- string(%s) "May %d, 2012 %d:%d:42 %s" +string(%s) "May %d, 2012 %d:%d:42 %s" ==DONE== diff --git a/ext/intl/tests/msgfmt_format_error5.phpt b/ext/intl/tests/msgfmt_format_error5.phpt index ebbd455..d5f62f9 100644 --- a/ext/intl/tests/msgfmt_format_error5.phpt +++ b/ext/intl/tests/msgfmt_format_error5.phpt @@ -20,7 +20,7 @@ $mf = new MessageFormatter('en_US', $fmt); var_dump($mf->format(array("foo" => new stdclass()))); --EXPECTF-- -Warning: MessageFormatter::format(): msgfmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted) in %s on line %d +Warning: MessageFormatter::format(): msgfmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted) in %s on line %d Warning: MessageFormatter::format(): The argument for key 'foo' cannot be used as a date or time in %s on line %d bool(false)
diff --git a/NEWS b/NEWS index 73aa8c3..97f07e1 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,8 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? ??? 2017, PHP 7.1.5 - +- Intl: + . Fixed bug #65683 (Intl does not support DateTimeImmutable). (Ben Scholzen) 13 Apr 2017, PHP 7.1.4 diff --git a/ext/intl/common/common_date.cpp b/ext/intl/common/common_date.cpp index f1bf75a..98c6393 100644 --- a/ext/intl/common/common_date.cpp +++ b/ext/intl/common/common_date.cpp @@ -145,8 +145,8 @@ U_CFUNC int intl_datetime_decompose(zval *z, double *millis, TimeZone **tz, php_date_obj *datetime; datetime = Z_PHPDATE_P(z); if (!datetime->time) { - spprintf(&message, 0, "%s: the DateTime object is not properly " - "initialized", func); + spprintf(&message, 0, "%s: the %s object is not properly " + "initialized", func, ZSTR_VAL(Z_OBJCE_P(z)->name)); intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1); efree(message); @@ -205,7 +205,7 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func) rv = U_MILLIS_PER_SECOND * Z_DVAL_P(z); break; case IS_OBJECT: - if (instanceof_function(Z_OBJCE_P(z), php_date_get_date_ce())) { + if (instanceof_function(Z_OBJCE_P(z), php_date_get_interface_ce())) { intl_datetime_decompose(z, &rv, NULL, err, func); } else if (instanceof_function(Z_OBJCE_P(z), Calendar_ce_ptr)) { Calendar_object *co = Z_INTL_CALENDAR_P(z); @@ -228,7 +228,7 @@ U_CFUNC double intl_zval_to_millis(zval *z, intl_error *err, const char *func) } else { /* TODO: try with cast(), get() to obtain a number */ spprintf(&message, 0, "%s: invalid object type for date/time " - "(only IntlCalendar and DateTime permitted)", func); + "(only IntlCalendar and DateTimeInterface permitted)", func); intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1); efree(message); diff --git a/ext/intl/tests/dateformat_bug65683.phpt b/ext/intl/tests/dateformat_bug65683.phpt new file mode 100644 index 0000000..d18cb4c --- /dev/null +++ b/ext/intl/tests/dateformat_bug65683.phpt @@ -0,0 +1,16 @@ +--TEST-- +Bug #65683 IntlDateFormatter accepts DateTimeImmutable +--SKIPIF-- +<?php +if (!extension_loaded('intl')) die('skip intl extension not enabled'); ?> +--FILE-- +<?php + +$formatter = new IntlDateFormatter('en-US', IntlDateFormatter::FULL, IntlDateFormatter::NONE, new DateTimeZone("UTC")); +var_dump($formatter->format(new DateTimeImmutable('2017-03-27 00:00:00 UTC'))) . "\n"; + +?> +==DONE== +--EXPECTF-- +string(%s) "Monday, March %d, 2017" +==DONE== diff --git a/ext/intl/tests/dateformat_format.phpt b/ext/intl/tests/dateformat_format.phpt index 241c5f9..a0135a8 100644 --- a/ext/intl/tests/dateformat_format.phpt +++ b/ext/intl/tests/dateformat_format.phpt @@ -400,24 +400,24 @@ Formatted DateTime is : 20001230 05:04 PM Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' diff --git a/ext/intl/tests/dateformat_format_variant2.phpt b/ext/intl/tests/dateformat_format_variant2.phpt index 07c67e9..a3df39a 100644 --- a/ext/intl/tests/dateformat_format_variant2.phpt +++ b/ext/intl/tests/dateformat_format_variant2.phpt @@ -400,24 +400,24 @@ Formatted DateTime is : 20001230 05:04 PM Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' diff --git a/ext/intl/tests/dateformat_format_variant3.phpt b/ext/intl/tests/dateformat_format_variant3.phpt index d770473..da0d662 100644 --- a/ext/intl/tests/dateformat_format_variant3.phpt +++ b/ext/intl/tests/dateformat_format_variant3.phpt @@ -400,24 +400,24 @@ Formatted DateTime is : 20001230 05:04 PM Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' ------------ Date is: stdClass::__set_state(array( )) ------------ -Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted): U_ILLEGAL_ARGUMENT_ERROR' +Error while formatting as: 'datefmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted): U_ILLEGAL_ARGUMENT_ERROR' diff --git a/ext/intl/tests/msgfmt_format_datetime.phpt b/ext/intl/tests/msgfmt_format_datetime.phpt index 07e7d68..bf0d24b 100644 --- a/ext/intl/tests/msgfmt_format_datetime.phpt +++ b/ext/intl/tests/msgfmt_format_datetime.phpt @@ -16,13 +16,16 @@ $fmt = <<<EOD EOD; $dt = new DateTime("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon")); +$dti = new DateTimeImmutable("2012-05-06 18:00:42", new DateTimeZone("Europe/Lisbon")); $mf = new MessageFormatter('en_US', $fmt); var_dump($mf->format(array($dt))); +var_dump($mf->format(array($dti))); ?> ==DONE== --EXPECTF-- string(%s) "May %d, 2012 %d:%d:42 %s" +string(%s) "May %d, 2012 %d:%d:42 %s" ==DONE== diff --git a/ext/intl/tests/msgfmt_format_error5.phpt b/ext/intl/tests/msgfmt_format_error5.phpt index ebbd455..d5f62f9 100644 --- a/ext/intl/tests/msgfmt_format_error5.phpt +++ b/ext/intl/tests/msgfmt_format_error5.phpt @@ -20,7 +20,7 @@ $mf = new MessageFormatter('en_US', $fmt); var_dump($mf->format(array("foo" => new stdclass()))); --EXPECTF-- -Warning: MessageFormatter::format(): msgfmt_format: invalid object type for date/time (only IntlCalendar and DateTime permitted) in %s on line %d +Warning: MessageFormatter::format(): msgfmt_format: invalid object type for date/time (only IntlCalendar and DateTimeInterface permitted) in %s on line %d Warning: MessageFormatter::format(): The argument for key 'foo' cannot be used as a date or time in %s on line %d bool(false)