mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Deprecate IntlCalendar::roll() with bool argument
Pass 1 instead of true and -1 instead of false. Part of https://wiki.php.net/rfc/deprecations_php_8_1.
This commit is contained in:
parent
92f6e21523
commit
1c50784ae7
@ -337,6 +337,11 @@ PHP 8.1 UPGRADE NOTES
|
||||
favor of date_sun_info().
|
||||
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
|
||||
|
||||
- Intl:
|
||||
. Calling IntlCalendar::roll() with bool argument is deprecated. Pass 1 and -1
|
||||
instead of true and false respectively.
|
||||
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
|
||||
|
||||
- Mbstring:
|
||||
. Calling mb_check_encoding() without an argument is deprecated.
|
||||
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
|
||||
|
@ -424,6 +424,7 @@ U_CFUNC PHP_FUNCTION(intlcal_roll)
|
||||
|
||||
if (Z_TYPE_P(zvalue) == IS_FALSE || Z_TYPE_P(zvalue) == IS_TRUE) {
|
||||
value = Z_TYPE_P(zvalue) == IS_TRUE ? 1 : -1;
|
||||
php_error_docref(NULL, E_DEPRECATED, "Passing bool is deprecated, use 1 or -1 instead");
|
||||
} else {
|
||||
value = zval_get_long(zvalue);
|
||||
ZEND_VALUE_ERROR_OUT_OF_BOUND_VALUE(value, 3);
|
||||
|
@ -11,7 +11,7 @@ $intlcal1 = IntlCalendar::createInstance('Europe/Amsterdam');
|
||||
$intlcal2 = IntlCalendar::createInstance('Europe/Lisbon');
|
||||
$intlcal3 = IntlCalendar::createInstance('Europe/Amsterdam', "nl_NL@calendar=islamic");
|
||||
$intlcal4 = IntlCalendar::createInstance('Europe/Amsterdam');
|
||||
$intlcal4->roll(IntlCalendar::FIELD_MONTH, true);
|
||||
$intlcal4->roll(IntlCalendar::FIELD_MONTH, 1);
|
||||
|
||||
var_dump(
|
||||
"1 - 1",
|
||||
@ -33,4 +33,4 @@ bool(false)
|
||||
string(5) "1 - 3"
|
||||
bool(false)
|
||||
string(5) "1 - 4"
|
||||
bool(true)
|
||||
bool(true)
|
||||
|
@ -19,10 +19,13 @@ var_dump($intlcal->get(IntlCalendar::FIELD_MONTH)); //1 (Feb)
|
||||
var_dump($intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH)); //28
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Deprecated: IntlCalendar::roll(): Passing bool is deprecated, use 1 or -1 instead in %s on line %d
|
||||
bool(true)
|
||||
int(1)
|
||||
int(29)
|
||||
|
||||
Deprecated: intlcal_roll(): Passing bool is deprecated, use 1 or -1 instead in %s on line %d
|
||||
bool(true)
|
||||
int(1)
|
||||
int(28)
|
||||
int(28)
|
||||
|
Loading…
Reference in New Issue
Block a user