com php-src: Allow DateTimeImmutable in datefmt_format_obje ct(): ext/intl/dateformat/dateformat_format_object .cpp
ext/intl/tests/dateformat_bug65683_2 .phpt
| From: | Nikita Popov | Date: | Mon, 18 Mar 2019 10:39:16 +0000 |
| Subject: | com php-src: Allow DateTimeImmutable in datefmt_format_obje ct(): ext/intl/dateformat/dateformat_format_object .cpp ext/intl/tests/dateformat_bug65683_2 .phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105209@lists.php.net to get a copy of this message | ||
Commit: 433758ceb3e11df184a87e8185fbd7f8b969fb79
Author: Nikita Popov <nikita.ppv@gmail.com> Mon, 18 Mar 2019 11:39:16 +0100
Parents: 4f034016289f5a52073bfd012899dd3e202742b5
Branches: PHP-7.2 PHP-7.3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=433758ceb3e11df184a87e8185fbd7f8b969fb79
Log:
Allow DateTimeImmutable in datefmt_format_object()
As pointed out in a comment on bug #65683.
Bugs:
https://bugs.php.net/65683
Changed paths:
M ext/intl/dateformat/dateformat_format_object.cpp
A ext/intl/tests/dateformat_bug65683_2.phpt
Diff:
diff --git a/ext/intl/dateformat/dateformat_format_object.cpp
b/ext/intl/dateformat/dateformat_format_object.cpp
index e96ebe8..fa6dc76 100644
--- a/ext/intl/dateformat/dateformat_format_object.cpp
+++ b/ext/intl/dateformat/dateformat_format_object.cpp
@@ -169,7 +169,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
goto cleanup;
}
cal = obj_cal->clone();
- } else if (instanceof_function(instance_ce, php_date_get_date_ce())) {
+ } else if (instanceof_function(instance_ce, php_date_get_interface_ce())) {
if (intl_datetime_decompose(object, &date, &timeZone, NULL,
"datefmt_format_object") == FAILURE) {
RETURN_FALSE;
diff --git a/ext/intl/tests/dateformat_bug65683_2.phpt b/ext/intl/tests/dateformat_bug65683_2.phpt
new file mode 100644
index 0000000..67d9d78
--- /dev/null
+++ b/ext/intl/tests/dateformat_bug65683_2.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #65683: Intl does not support DateTimeImmutable (using datefmt_format_object)
+--FILE--
+<?php
+$date = date_create('1970-01-01');
+$date_imm = date_create_immutable('1970-01-01');
+var_dump(datefmt_format_object($date, null, 'fr_FR'));
+var_dump(datefmt_format_object($date_imm, null, 'fr_FR'));
+?>
+--EXPECT--
+string(24) "1 janv. 1970 à 00:00:00"
+string(24) "1 janv. 1970 à 00:00:00"