mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Deprecate calling IntlCalendar::set() with more than 2 arguments and intlcal_set()
This commit is contained in:
parent
adc26424aa
commit
f4df37af3d
11 changed files with 40 additions and 11 deletions
|
@ -146,6 +146,10 @@ PHP 8.4 UPGRADE NOTES
|
||||||
. Calling DatePeriod::__construct(string $isostr, int $options = 0) is
|
. Calling DatePeriod::__construct(string $isostr, int $options = 0) is
|
||||||
deprecated. Use DatePeriod::createFromISO8601String() instead.
|
deprecated. Use DatePeriod::createFromISO8601String() instead.
|
||||||
|
|
||||||
|
- Intl:
|
||||||
|
. Calling intlcal_set() as well as calling IntlCalendar::set() with
|
||||||
|
more than 2 arguments is deprecated. Use either IntlCalendar::setDate()
|
||||||
|
or IntlCalendar::setDateTime() instead.
|
||||||
========================================
|
========================================
|
||||||
5. Changed Functions
|
5. Changed Functions
|
||||||
========================================
|
========================================
|
||||||
|
|
|
@ -316,7 +316,7 @@ class IntlCalendar
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true
|
* @return true
|
||||||
* @alias intlcal_set
|
* @implementation-alias intlcal_set
|
||||||
*/
|
*/
|
||||||
public function set(int $year, int $month, int $dayOfMonth = UNKNOWN, int $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN) {} // TODO make return type void
|
public function set(int $year, int $month, int $dayOfMonth = UNKNOWN, int $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN) {} // TODO make return type void
|
||||||
|
|
||||||
|
|
2
ext/intl/calendar/calendar_arginfo.h
generated
2
ext/intl/calendar/calendar_arginfo.h
generated
|
@ -1,5 +1,5 @@
|
||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: cbb02e588a6954e7e92556e7ce656ea36a05cf3f */
|
* Stub hash: dbd7f8dd82cfdca04988aa791523b29b564347e0 */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar___construct, 0, 0, 0)
|
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IntlCalendar___construct, 0, 0, 0)
|
||||||
ZEND_END_ARG_INFO()
|
ZEND_END_ARG_INFO()
|
||||||
|
|
|
@ -377,6 +377,14 @@ U_CFUNC PHP_FUNCTION(intlcal_set)
|
||||||
|
|
||||||
int arg_num = ZEND_NUM_ARGS() - (object ? 0 : 1);
|
int arg_num = ZEND_NUM_ARGS() - (object ? 0 : 1);
|
||||||
|
|
||||||
|
if (object && arg_num > 2) {
|
||||||
|
zend_error(E_DEPRECATED, "Calling IntlCalendar::set() with more than 2 arguments is deprecated, "
|
||||||
|
"use either IntlCalendar::setDate() or IntlCalendar::setDateTime() instead");
|
||||||
|
if (UNEXPECTED(EG(exception))) {
|
||||||
|
RETURN_THROWS();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (zend_parse_method_parameters(
|
if (zend_parse_method_parameters(
|
||||||
ZEND_NUM_ARGS(), object, "Oll|llll",
|
ZEND_NUM_ARGS(), object, "Oll|llll",
|
||||||
&object, Calendar_ce_ptr, &args[0], &args[1], &args[2], &args[3], &args[4], &args[5]
|
&object, Calendar_ce_ptr, &args[0], &args[1], &args[2], &args[3], &args[4], &args[5]
|
||||||
|
|
|
@ -201,6 +201,7 @@ function intlcal_after(IntlCalendar $calendar, IntlCalendar $other): bool {}
|
||||||
|
|
||||||
function intlcal_before(IntlCalendar $calendar, IntlCalendar $other): bool {}
|
function intlcal_before(IntlCalendar $calendar, IntlCalendar $other): bool {}
|
||||||
|
|
||||||
|
/** @deprecated */
|
||||||
function intlcal_set(IntlCalendar $calendar, int $year, int $month, int $dayOfMonth = UNKNOWN, int $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN): true {}
|
function intlcal_set(IntlCalendar $calendar, int $year, int $month, int $dayOfMonth = UNKNOWN, int $hour = UNKNOWN, int $minute = UNKNOWN, int $second = UNKNOWN): true {}
|
||||||
|
|
||||||
/** @param int|bool $value */
|
/** @param int|bool $value */
|
||||||
|
|
4
ext/intl/php_intl_arginfo.h
generated
4
ext/intl/php_intl_arginfo.h
generated
|
@ -1,5 +1,5 @@
|
||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: c32e74bddb55455f69083a302bcaf52f654b1293 */
|
* Stub hash: 9b71cd87f05bb7644a98c9855afba4742ac6203c */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_intlcal_create_instance, 0, 0, IntlCalendar, 1)
|
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")
|
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, timezone, "null")
|
||||||
|
@ -987,7 +987,7 @@ static const zend_function_entry ext_functions[] = {
|
||||||
ZEND_FE(intlcal_set_time_zone, arginfo_intlcal_set_time_zone)
|
ZEND_FE(intlcal_set_time_zone, arginfo_intlcal_set_time_zone)
|
||||||
ZEND_FE(intlcal_after, arginfo_intlcal_after)
|
ZEND_FE(intlcal_after, arginfo_intlcal_after)
|
||||||
ZEND_FE(intlcal_before, arginfo_intlcal_before)
|
ZEND_FE(intlcal_before, arginfo_intlcal_before)
|
||||||
ZEND_FE(intlcal_set, arginfo_intlcal_set)
|
ZEND_DEP_FE(intlcal_set, arginfo_intlcal_set)
|
||||||
ZEND_FE(intlcal_roll, arginfo_intlcal_roll)
|
ZEND_FE(intlcal_roll, arginfo_intlcal_roll)
|
||||||
ZEND_FE(intlcal_clear, arginfo_intlcal_clear)
|
ZEND_FE(intlcal_clear, arginfo_intlcal_clear)
|
||||||
ZEND_FE(intlcal_field_difference, arginfo_intlcal_field_difference)
|
ZEND_FE(intlcal_field_difference, arginfo_intlcal_field_difference)
|
||||||
|
|
|
@ -21,7 +21,8 @@ var_dump($intlcal->get(IntlCalendar::FIELD_MINUTE));
|
||||||
var_dump($intlcal->isSet(IntlCalendar::FIELD_SECOND));
|
var_dump($intlcal->isSet(IntlCalendar::FIELD_SECOND));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: Calling IntlCalendar::set() with more than 2 arguments is deprecated, use either IntlCalendar::setDate() or IntlCalendar::setDateTime() instead in %s on line %d
|
||||||
bool(false)
|
bool(false)
|
||||||
int(58)
|
int(58)
|
||||||
bool(true)
|
bool(true)
|
||||||
|
|
|
@ -16,8 +16,10 @@ var_dump(intlcal_set($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH, 3));
|
||||||
var_dump($intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH));
|
var_dump($intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH));
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
bool(true)
|
bool(true)
|
||||||
int(2)
|
int(2)
|
||||||
|
|
||||||
|
Deprecated: Function intlcal_set() is deprecated in %s on line %d
|
||||||
bool(true)
|
bool(true)
|
||||||
int(3)
|
int(3)
|
||||||
|
|
|
@ -40,9 +40,16 @@ try {
|
||||||
echo $e->getMessage() . \PHP_EOL;
|
echo $e->getMessage() . \PHP_EOL;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: Calling IntlCalendar::set() with more than 2 arguments is deprecated, use either IntlCalendar::setDate() or IntlCalendar::setDateTime() instead in %s on line %d
|
||||||
IntlCalendar::set() expects at most 6 arguments, 7 given
|
IntlCalendar::set() expects at most 6 arguments, 7 given
|
||||||
|
|
||||||
|
Deprecated: Calling IntlCalendar::set() with more than 2 arguments is deprecated, use either IntlCalendar::setDate() or IntlCalendar::setDateTime() instead in %s on line %d
|
||||||
IntlCalendar::set() has no variant with exactly 4 parameters
|
IntlCalendar::set() has no variant with exactly 4 parameters
|
||||||
IntlCalendar::set(): Argument #1 ($year) must be a valid field
|
IntlCalendar::set(): Argument #1 ($year) must be a valid field
|
||||||
|
|
||||||
|
Deprecated: Function intlcal_set() is deprecated in %s on line %d
|
||||||
intlcal_set(): Argument #2 ($year) must be a valid field
|
intlcal_set(): Argument #2 ($year) must be a valid field
|
||||||
|
|
||||||
|
Deprecated: Function intlcal_set() is deprecated in %s on line %d
|
||||||
intlcal_set(): Argument #1 ($calendar) must be of type IntlCalendar, int given
|
intlcal_set(): Argument #1 ($calendar) must be of type IntlCalendar, int given
|
||||||
|
|
|
@ -25,13 +25,18 @@ var_dump($intlcal->getTime(),
|
||||||
strtotime('2012-02-29 23:58:31 +0000') * 1000.);
|
strtotime('2012-02-29 23:58:31 +0000') * 1000.);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: Calling IntlCalendar::set() with more than 2 arguments is deprecated, use either IntlCalendar::setDate() or IntlCalendar::setDateTime() instead in %s on line %d
|
||||||
bool(true)
|
bool(true)
|
||||||
float(1330473600000)
|
float(1330473600000)
|
||||||
float(1330473600000)
|
float(1330473600000)
|
||||||
|
|
||||||
|
Deprecated: Calling IntlCalendar::set() with more than 2 arguments is deprecated, use either IntlCalendar::setDate() or IntlCalendar::setDateTime() instead in %s on line %d
|
||||||
bool(true)
|
bool(true)
|
||||||
float(1330559880000)
|
float(1330559880000)
|
||||||
float(1330559880000)
|
float(1330559880000)
|
||||||
|
|
||||||
|
Deprecated: Calling IntlCalendar::set() with more than 2 arguments is deprecated, use either IntlCalendar::setDate() or IntlCalendar::setDateTime() instead in %s on line %d
|
||||||
bool(true)
|
bool(true)
|
||||||
float(1330559911000)
|
float(1330559911000)
|
||||||
float(1330559911000)
|
float(1330559911000)
|
||||||
|
|
|
@ -14,6 +14,7 @@ $dt = $cal->toDateTime();
|
||||||
|
|
||||||
var_dump($dt->format("c"), $dt->getTimeZone()->getName());
|
var_dump($dt->format("c"), $dt->getTimeZone()->getName());
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECTF--
|
||||||
|
Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated in %s on line %d
|
||||||
string(25) "2012-05-17T17:35:36+01:00"
|
string(25) "2012-05-17T17:35:36+01:00"
|
||||||
string(13) "Europe/Lisbon"
|
string(13) "Europe/Lisbon"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue