From 433758ceb3e11df184a87e8185fbd7f8b969fb79 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Mon, 18 Mar 2019 11:39:16 +0100 Subject: [PATCH] Allow DateTimeImmutable in datefmt_format_object() As pointed out in a comment on bug #65683. --- ext/intl/dateformat/dateformat_format_object.cpp | 2 +- ext/intl/tests/dateformat_bug65683_2.phpt | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 ext/intl/tests/dateformat_bug65683_2.phpt diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp index e96ebe8243..fa6dc76255 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 0000000000..67d9d7884a --- /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-- + +--EXPECT-- +string(24) "1 janv. 1970 à 00:00:00" +string(24) "1 janv. 1970 à 00:00:00" -- 2.40.0