From 05ed47ef127ab081907d8a67d096a861ce965a55 Mon Sep 17 00:00:00 2001 From: Gert de Pagter Date: Mon, 15 Aug 2022 14:25:59 +0200 Subject: [PATCH] Correct IntlDateFormatter::formatObject params Closes GH-9341. --- NEWS | 3 +++ ext/intl/dateformat/dateformat.stub.php | 2 +- ext/intl/dateformat/dateformat_arginfo.h | 2 +- ext/intl/dateformat/dateformat_format_object.cpp | 2 +- ext/intl/tests/dateformat_formatObject_error.phpt | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index ba942a7196e01..caf69a2627f8e 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,9 @@ PHP NEWS . Fixed bug GH-9155 (dba_open("non-existing", "c-", "flatfile") segfaults). (cmb) +- Intl: + . Fixed IntlDateFormatter::formatObject() parameter type. (Gert de Pagter) + - OPcache: . Fixed bug GH-9033 (Loading blacklist file can fail due to negative length). (cmb) diff --git a/ext/intl/dateformat/dateformat.stub.php b/ext/intl/dateformat/dateformat.stub.php index e6f9522dd4e31..36f77771d9090 100644 --- a/ext/intl/dateformat/dateformat.stub.php +++ b/ext/intl/dateformat/dateformat.stub.php @@ -104,7 +104,7 @@ public function isLenient() {} public function format($datetime) {} /** - * @param IntlCalendar|DateTime $datetime + * @param IntlCalendar|DateTimeInterface $datetime * @param array|int|string|null $format * @return string|false * @alias datefmt_format_object diff --git a/ext/intl/dateformat/dateformat_arginfo.h b/ext/intl/dateformat/dateformat_arginfo.h index 8830fa615e801..63a50733d86bd 100644 --- a/ext/intl/dateformat/dateformat_arginfo.h +++ b/ext/intl/dateformat/dateformat_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: faeef90c9c1324c6a25f0df36c7239ddc2b43ee4 */ + * Stub hash: 425a285b704e175ccd0313fe1be85c8abaf820b7 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter___construct, 0, 0, 3) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1) diff --git a/ext/intl/dateformat/dateformat_format_object.cpp b/ext/intl/dateformat/dateformat_format_object.cpp index d569eb935d26b..c979dcce8f746 100644 --- a/ext/intl/dateformat/dateformat_format_object.cpp +++ b/ext/intl/dateformat/dateformat_format_object.cpp @@ -190,7 +190,7 @@ U_CFUNC PHP_FUNCTION(datefmt_format_object) } } else { intl_error_set(NULL, status, "datefmt_format_object: the passed object " - "must be an instance of either IntlCalendar or DateTime", + "must be an instance of either IntlCalendar or DateTimeInterface", 0); RETURN_FALSE; } diff --git a/ext/intl/tests/dateformat_formatObject_error.phpt b/ext/intl/tests/dateformat_formatObject_error.phpt index 29a8798e799ed..dcb5506c4d8a8 100644 --- a/ext/intl/tests/dateformat_formatObject_error.phpt +++ b/ext/intl/tests/dateformat_formatObject_error.phpt @@ -31,7 +31,7 @@ var_dump(IntlDateFormatter::formatObject($cal, "")); ?> --EXPECTF-- -Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the passed object must be an instance of either IntlCalendar or DateTime in %s on line %d +Warning: IntlDateFormatter::formatObject(): datefmt_format_object: the passed object must be an instance of either IntlCalendar or DateTimeInterface in %s on line %d bool(false) Warning: IntlDateFormatter::formatObject(): datefmt_format_object: bad IntlCalendar instance: not initialized properly in %s on line %d