Skip to content

Commit 97e6f3d

Browse files
committed
ext/intl: dateformatter settimezone changes on success, returning true
like setcalendar.
1 parent 6a71153 commit 97e6f3d

7 files changed

+12
-6
lines changed

UPGRADING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ PHP 8.3 UPGRADE NOTES
7676
- Dom:
7777
. Changed DOMCharacterData::appendData() tentative return type to true.
7878

79+
- Intl:
80+
. IntlDateformatter::setTimeZone now returns true on sucess, previously null
81+
was returned.
82+
7983
- MBString:
8084
. mb_strtolower, mb_strtotitle, and mb_convert_case implement conditional
8185
casing rules for the Greek letter sigma. For mb_convert_case, conditional

ext/intl/dateformat/dateformat.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function getTimeZone(): IntlTimeZone|false {}
136136
* @tentative-return-type
137137
* @alias datefmt_set_timezone
138138
*/
139-
public function setTimeZone($timezone): ?bool {} // TODO return true on success
139+
public function setTimeZone($timezone): bool {}
140140

141141
/**
142142
* @tentative-return-type

ext/intl/dateformat/dateformat_arginfo.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/intl/dateformat/dateformat_attrcpp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ U_CFUNC PHP_FUNCTION(datefmt_set_timezone)
101101
}
102102

103103
fetch_datefmt(dfo)->adoptTimeZone(timezone);
104+
105+
RETURN_TRUE;
104106
}
105107

106108
/* {{{ Get formatter calendar type. */

ext/intl/tests/dateformat_set_timezone_id2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function ut_main()
3737

3838
$res_str .= "-----------";
3939
$res_str .= "\nTrying to set timezone_id= $timezone_id_entry";
40-
ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry );
40+
if (ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ) !== true) die("ut_datefmt_set_timezone_id failed");
4141
$timezone_id = ut_datefmt_get_timezone_id( $fmt );
4242
$res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id";
4343
$formatted = ut_datefmt_format( $fmt, 0);

ext/intl/tests/dateformat_set_timezone_id3.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function ut_main()
3838

3939
$res_str .= "-----------";
4040
$res_str .= "\nTrying to set timezone_id= $timezone_id_entry";
41-
ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry );
41+
if (ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ) !== true) die("ut_datefmt_set_timezone_id failed");
4242
$timezone_id = ut_datefmt_get_timezone_id( $fmt );
4343
$res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id";
4444
$formatted = ut_datefmt_format( $fmt, 0);

ext/intl/tests/dateformat_set_timezone_id_icu72-1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function ut_main()
3737

3838
$res_str .= "-----------";
3939
$res_str .= "\nTrying to set timezone_id= $timezone_id_entry";
40-
ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry );
40+
if (ut_datefmt_set_timezone_id( $fmt , $timezone_id_entry ) !== true) die("ut_datefmt_set_timezone_id failed");
4141
$timezone_id = ut_datefmt_get_timezone_id( $fmt );
4242
$res_str .= "\nAfter call to set_timezone_id : timezone_id= $timezone_id";
4343
$formatted = ut_datefmt_format( $fmt, 0);

0 commit comments

Comments
 (0)