diff --git a/UPGRADING b/UPGRADING index cdada9e9b3273..ebadbb0a1f58d 100644 --- a/UPGRADING +++ b/UPGRADING @@ -76,6 +76,10 @@ PHP 8.3 UPGRADE NOTES - Dom: . Changed DOMCharacterData::appendData() tentative return type to true. +- Intl: + . datefmt_set_timezone (and its alias IntlDateformatter::setTimeZone) + now returns true on sucess, previously null was returned. + - MBString: . mb_strtolower, mb_strtotitle, and mb_convert_case implement conditional casing rules for the Greek letter sigma. For mb_convert_case, conditional diff --git a/ext/intl/dateformat/dateformat.stub.php b/ext/intl/dateformat/dateformat.stub.php index ed49bcc0d89a9..3e5f178491bda 100644 --- a/ext/intl/dateformat/dateformat.stub.php +++ b/ext/intl/dateformat/dateformat.stub.php @@ -136,7 +136,7 @@ public function getTimeZone(): IntlTimeZone|false {} * @tentative-return-type * @alias datefmt_set_timezone */ - public function setTimeZone($timezone): ?bool {} // TODO return true on success + public function setTimeZone($timezone): bool {} /** * @tentative-return-type diff --git a/ext/intl/dateformat/dateformat_arginfo.h b/ext/intl/dateformat/dateformat_arginfo.h index 6026077c1ac23..6391c5839e09f 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: cefec46af242e6372a923dea0e1d2cf22da7ef3e */ + * Stub hash: c3aabab98e4864276f6cb0afb2e3fefad0386481 */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlDateFormatter___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, locale, IS_STRING, 1) @@ -39,7 +39,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_TYPE_MASK_EX(arginfo_class_IntlDateFormatter_getTimeZone, 0, 0, IntlTimeZone, MAY_BE_FALSE) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_IntlDateFormatter_setTimeZone, 0, 1, _IS_BOOL, 1) +ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_IntlDateFormatter_setTimeZone, 0, 1, _IS_BOOL, 0) ZEND_ARG_INFO(0, timezone) ZEND_END_ARG_INFO() diff --git a/ext/intl/dateformat/dateformat_attrcpp.cpp b/ext/intl/dateformat/dateformat_attrcpp.cpp index a9b9a3d8f5079..e34c331800622 100644 --- a/ext/intl/dateformat/dateformat_attrcpp.cpp +++ b/ext/intl/dateformat/dateformat_attrcpp.cpp @@ -101,6 +101,8 @@ U_CFUNC PHP_FUNCTION(datefmt_set_timezone) } fetch_datefmt(dfo)->adoptTimeZone(timezone); + + RETURN_TRUE; } /* {{{ Get formatter calendar type. */ diff --git a/ext/intl/php_intl.stub.php b/ext/intl/php_intl.stub.php index c21ad58fa092e..8980a807919b9 100644 --- a/ext/intl/php_intl.stub.php +++ b/ext/intl/php_intl.stub.php @@ -351,7 +351,7 @@ function datefmt_get_calendar_object(IntlDateFormatter $formatter): IntlCalendar function datefmt_get_timezone(IntlDateFormatter $formatter): IntlTimeZone|false {} /** @param IntlTimeZone|DateTimeZone|string|null $timezone */ -function datefmt_set_timezone(IntlDateFormatter $formatter, $timezone): ?bool {} +function datefmt_set_timezone(IntlDateFormatter $formatter, $timezone): bool {} function datefmt_set_pattern(IntlDateFormatter $formatter, string $pattern): bool {} diff --git a/ext/intl/php_intl_arginfo.h b/ext/intl/php_intl_arginfo.h index b715413989145..8f2903315a386 100644 --- a/ext/intl/php_intl_arginfo.h +++ b/ext/intl/php_intl_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 7008d442eba36e2bc468cc4a7a30eb859d10c07d */ + * Stub hash: 136c14d9162548cd7211985ce9a5d767a90a0b99 */ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1) ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null") @@ -310,7 +310,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_datefmt_get_timezone, 0, 1, ZEND_ARG_OBJ_INFO(0, formatter, IntlDateFormatter, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_timezone, 0, 2, _IS_BOOL, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_datefmt_set_timezone, 0, 2, _IS_BOOL, 0) ZEND_ARG_OBJ_INFO(0, formatter, IntlDateFormatter, 0) ZEND_ARG_INFO(0, timezone) ZEND_END_ARG_INFO() diff --git a/ext/intl/tests/dateformat_set_timezone_id2.phpt b/ext/intl/tests/dateformat_set_timezone_id2.phpt index 6c21df6feed56..fa9e68bd86764 100644 --- a/ext/intl/tests/dateformat_set_timezone_id2.phpt +++ b/ext/intl/tests/dateformat_set_timezone_id2.phpt @@ -37,7 +37,7 @@ function ut_main() $res_str .= "-----------"; $res_str .= "\nTrying to set timezone_id= $timezone_id_entry"; - ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ); + if (ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ) !== true) die("ut_datefmt_set_timezone_id failed"); $timezone_id = ut_datefmt_get_timezone_id( $fmt ); $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id"; $formatted = ut_datefmt_format( $fmt, 0); diff --git a/ext/intl/tests/dateformat_set_timezone_id3.phpt b/ext/intl/tests/dateformat_set_timezone_id3.phpt index a4952eb5a3dcb..ec14db3e60623 100644 --- a/ext/intl/tests/dateformat_set_timezone_id3.phpt +++ b/ext/intl/tests/dateformat_set_timezone_id3.phpt @@ -20,10 +20,10 @@ ini_set("intl.error_level", E_WARNING); function ut_main() { $timezone_id_arr = array ( - 'America/New_York', - 'America/Los_Angeles', - 'America/Chicago', - 'CN' + 'America/New_York' => true, + 'America/Los_Angeles' => true, + 'America/Chicago' => true, + 'CN' => false ); $timestamp_entry = 0; @@ -33,12 +33,12 @@ function ut_main() $timezone_id = ut_datefmt_get_timezone_id( $fmt ); $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n"; - foreach( $timezone_id_arr as $timezone_id_entry ) + foreach( $timezone_id_arr as $timezone_id_entry => $result ) { $res_str .= "-----------"; $res_str .= "\nTrying to set timezone_id= $timezone_id_entry"; - ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ); + if (ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ) !== $result) die("ut_datefmt_set_timezone_id failed"); $timezone_id = ut_datefmt_get_timezone_id( $fmt ); $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id"; $formatted = ut_datefmt_format( $fmt, 0); diff --git a/ext/intl/tests/dateformat_set_timezone_id_icu72-1.phpt b/ext/intl/tests/dateformat_set_timezone_id_icu72-1.phpt index aedf886da2dd0..79953ab26b465 100644 --- a/ext/intl/tests/dateformat_set_timezone_id_icu72-1.phpt +++ b/ext/intl/tests/dateformat_set_timezone_id_icu72-1.phpt @@ -19,10 +19,10 @@ ini_set("intl.error_level", E_WARNING); function ut_main() { $timezone_id_arr = array ( - 'America/New_York', - 'America/Los_Angeles', - 'America/Chicago', - 'CN' + 'America/New_York' => true, + 'America/Los_Angeles' => true, + 'America/Chicago' => true, + 'CN' => false ); $timestamp_entry = 0; @@ -32,12 +32,12 @@ function ut_main() $timezone_id = ut_datefmt_get_timezone_id( $fmt ); $res_str .= "\nAfter creation of the dateformatter : timezone_id= $timezone_id\n"; - foreach( $timezone_id_arr as $timezone_id_entry ) + foreach( $timezone_id_arr as $timezone_id_entry => $result ) { $res_str .= "-----------"; $res_str .= "\nTrying to set timezone_id= $timezone_id_entry"; - ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ); + if (ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ) !== $result) die("ut_datefmt_set_timezone_id failed"); $timezone_id = ut_datefmt_get_timezone_id( $fmt ); $res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id"; $formatted = ut_datefmt_format( $fmt, 0);