Skip to content

Commit 433758c

Browse files
committed
Allow DateTimeImmutable in datefmt_format_object()
As pointed out in a comment on bug #65683.
1 parent 4f03401 commit 433758c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

ext/intl/dateformat/dateformat_format_object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object)
169169
goto cleanup;
170170
}
171171
cal = obj_cal->clone();
172-
} else if (instanceof_function(instance_ce, php_date_get_date_ce())) {
172+
} else if (instanceof_function(instance_ce, php_date_get_interface_ce())) {
173173
if (intl_datetime_decompose(object, &date, &timeZone, NULL,
174174
"datefmt_format_object") == FAILURE) {
175175
RETURN_FALSE;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--TEST--
2+
Bug #65683: Intl does not support DateTimeImmutable (using datefmt_format_object)
3+
--FILE--
4+
<?php
5+
$date = date_create('1970-01-01');
6+
$date_imm = date_create_immutable('1970-01-01');
7+
var_dump(datefmt_format_object($date, null, 'fr_FR'));
8+
var_dump(datefmt_format_object($date_imm, null, 'fr_FR'));
9+
?>
10+
--EXPECT--
11+
string(24) "1 janv. 1970 à 00:00:00"
12+
string(24) "1 janv. 1970 à 00:00:00"

0 commit comments

Comments
 (0)