From 3d95d095fb9554791460bab9a1d503f08046ebc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sat, 18 Nov 2023 22:37:11 +0100 Subject: [PATCH 1/7] Deprecate calling DatePeriod::__construct() with less than 3 arguments --- UPGRADING | 4 ++++ ext/date/php_date.c | 6 ++++++ ext/date/tests/DatePeriod_IteratorAggregate.phpt | 7 ++++++- ext/date/tests/DatePeriod_wrong_arguments.phpt | 4 +++- ext/date/tests/bug44562.phpt | 3 ++- ext/date/tests/bug54283.phpt | 2 ++ ext/date/tests/date_interval_bad_format_leak.phpt | 6 +++++- ext/date/tests/date_period_bad_iso_format.phpt | 7 ++++++- 8 files changed, 34 insertions(+), 5 deletions(-) diff --git a/UPGRADING b/UPGRADING index 5c90712f53570..f91610371eb8b 100644 --- a/UPGRADING +++ b/UPGRADING @@ -128,6 +128,10 @@ PHP 8.4 UPGRADE NOTES 4. Deprecated Functionality ======================================== +- Date: + . Calling DatePeriod::__construct(string $isostr, int $options = 0) is + deprecated. Use DatePeriod::createFromISO8601String() instead. + ======================================== 5. Changed Functions ======================================== diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 509b09ef37ddd..f9695414af9be 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -5061,6 +5061,12 @@ PHP_METHOD(DatePeriod, __construct) dpobj->current = NULL; if (isostr) { + zend_error(E_DEPRECATED, "Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, " + "use DatePeriod::createFromISO8601String() instead"); + if (UNEXPECTED(EG(exception))) { + RETURN_THROWS(); + } + if (!date_period_init_iso8601_string(dpobj, date_ce_date, isostr, isostr_len, options, &recurrences)) { RETURN_THROWS(); } diff --git a/ext/date/tests/DatePeriod_IteratorAggregate.phpt b/ext/date/tests/DatePeriod_IteratorAggregate.phpt index f3221822b2b9e..426bf7b58fe24 100644 --- a/ext/date/tests/DatePeriod_IteratorAggregate.phpt +++ b/ext/date/tests/DatePeriod_IteratorAggregate.phpt @@ -58,7 +58,8 @@ foreach ($period as $i => $notDate) { } ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d 0: 2012-07-01 1: 2012-07-08 2: 2012-07-15 @@ -79,10 +80,14 @@ foreach ($period as $i => $notDate) { 1: 2012-07-08 2: 2012-07-15 + +Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d 0: 2012-07-01 1: 2012-07-08 2: 2012-07-15 + +Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d 0: 1 1: 2 2: 3 diff --git a/ext/date/tests/DatePeriod_wrong_arguments.phpt b/ext/date/tests/DatePeriod_wrong_arguments.phpt index f1be65badbdb3..1d200fb096fe3 100644 --- a/ext/date/tests/DatePeriod_wrong_arguments.phpt +++ b/ext/date/tests/DatePeriod_wrong_arguments.phpt @@ -21,9 +21,11 @@ try { echo $e::class, ': ', $e->getMessage(), "\n"; } ?> ---EXPECT-- +--EXPECTF-- OK OK + +Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d OK OK TypeError: DatePeriod::__construct() accepts (DateTimeInterface, DateInterval, int [, int]), or (DateTimeInterface, DateInterval, DateTime [, int]), or (string [, int]) as arguments diff --git a/ext/date/tests/bug44562.phpt b/ext/date/tests/bug44562.phpt index dd8953faa0d38..00bc1ee4f11dc 100644 --- a/ext/date/tests/bug44562.phpt +++ b/ext/date/tests/bug44562.phpt @@ -26,7 +26,8 @@ foreach ( $dp as $d ) } ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d DateMalformedPeriodStringException: Unknown or bad format (2D) DateMalformedPeriodStringException: Unknown or bad format (2D) string(24) "2008-07-20T22:44:53+0200" diff --git a/ext/date/tests/bug54283.phpt b/ext/date/tests/bug54283.phpt index 8aaa1e47f7212..6acf6e5c88062 100644 --- a/ext/date/tests/bug54283.phpt +++ b/ext/date/tests/bug54283.phpt @@ -12,4 +12,6 @@ try { ?> --EXPECTF-- Deprecated: DatePeriod::__construct(): Passing null to parameter #1 ($start) of type string is deprecated in %s on line %d + +Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d string(24) "Unknown or bad format ()" diff --git a/ext/date/tests/date_interval_bad_format_leak.phpt b/ext/date/tests/date_interval_bad_format_leak.phpt index 9ce9c8d051036..010621de7125f 100644 --- a/ext/date/tests/date_interval_bad_format_leak.phpt +++ b/ext/date/tests/date_interval_bad_format_leak.phpt @@ -34,9 +34,13 @@ try { } ?> ---EXPECT-- +--EXPECTF-- DateMalformedIntervalStringException: Unknown or bad format (P3"D) + +Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d DateMalformedPeriodStringException: Unknown or bad format (P3"D) DateMalformedPeriodStringException: Unknown or bad format (P3"D) + +Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d DateMalformedPeriodStringException: Unknown or bad format (2008-03-01T12:00:00Z1) DateMalformedPeriodStringException: Unknown or bad format (2008-03-01T12:00:00Z1) diff --git a/ext/date/tests/date_period_bad_iso_format.phpt b/ext/date/tests/date_period_bad_iso_format.phpt index dde177e739871..144b4cce1c51b 100644 --- a/ext/date/tests/date_period_bad_iso_format.phpt +++ b/ext/date/tests/date_period_bad_iso_format.phpt @@ -40,10 +40,15 @@ try { } ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d DateMalformedPeriodStringException: DatePeriod::__construct(): ISO interval must contain a start date, "R4" given DateMalformedPeriodStringException: DatePeriod::createFromISO8601String(): ISO interval must contain a start date, "R4" given + +Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d DateMalformedPeriodStringException: DatePeriod::__construct(): ISO interval must contain an interval, "R4/2012-07-01T00:00:00Z" given DateMalformedPeriodStringException: DatePeriod::createFromISO8601String(): ISO interval must contain an interval, "R4/2012-07-01T00:00:00Z" given + +Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d DateMalformedPeriodStringException: DatePeriod::__construct(): Recurrence count must be greater than 0 DateMalformedPeriodStringException: DatePeriod::createFromISO8601String(): Recurrence count must be greater than 0 From 01f6c76a3c76600f7b89e7a791a370ab4e72aa40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sat, 18 Nov 2023 22:55:52 +0100 Subject: [PATCH 2/7] Deprecate calling IntlCalendar::set() with more than 2 arguments and intlcal_set() --- UPGRADING | 4 ++++ ext/intl/calendar/calendar.stub.php | 2 +- ext/intl/calendar/calendar_arginfo.h | 2 +- ext/intl/calendar/calendar_methods.cpp | 8 ++++++++ ext/intl/php_intl.stub.php | 1 + ext/intl/php_intl_arginfo.h | 4 ++-- ext/intl/tests/calendar_isSet_empty_time.phpt | 3 ++- ext/intl/tests/calendar_set_basic.phpt | 6 ++++-- ext/intl/tests/calendar_set_error.phpt | 9 ++++++++- ext/intl/tests/calendar_set_variation1.phpt | 9 +++++++-- ext/intl/tests/calendar_toDateTime_basic.phpt | 3 ++- 11 files changed, 40 insertions(+), 11 deletions(-) diff --git a/UPGRADING b/UPGRADING index f91610371eb8b..5f172cdc86d6a 100644 --- a/UPGRADING +++ b/UPGRADING @@ -132,6 +132,10 @@ PHP 8.4 UPGRADE NOTES . Calling DatePeriod::__construct(string $isostr, int $options = 0) is 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 ======================================== diff --git a/ext/intl/calendar/calendar.stub.php b/ext/intl/calendar/calendar.stub.php index 7a1343931c238..828e869f0eec2 100644 --- a/ext/intl/calendar/calendar.stub.php +++ b/ext/intl/calendar/calendar.stub.php @@ -316,7 +316,7 @@ public function isSet(int $field): bool {} /** * @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 diff --git a/ext/intl/calendar/calendar_arginfo.h b/ext/intl/calendar/calendar_arginfo.h index 803771f6a1277..9c57d5b0d94a9 100644 --- a/ext/intl/calendar/calendar_arginfo.h +++ b/ext/intl/calendar/calendar_arginfo.h @@ -1,5 +1,5 @@ /* 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_END_ARG_INFO() diff --git a/ext/intl/calendar/calendar_methods.cpp b/ext/intl/calendar/calendar_methods.cpp index 506f3487f518d..d6801c4f64600 100644 --- a/ext/intl/calendar/calendar_methods.cpp +++ b/ext/intl/calendar/calendar_methods.cpp @@ -377,6 +377,14 @@ U_CFUNC PHP_FUNCTION(intlcal_set) 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( ZEND_NUM_ARGS(), object, "Oll|llll", &object, Calendar_ce_ptr, &args[0], &args[1], &args[2], &args[3], &args[4], &args[5] diff --git a/ext/intl/php_intl.stub.php b/ext/intl/php_intl.stub.php index eab42fcc0ff57..8eb1d97793076 100644 --- a/ext/intl/php_intl.stub.php +++ b/ext/intl/php_intl.stub.php @@ -201,6 +201,7 @@ function intlcal_after(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 {} /** @param int|bool $value */ diff --git a/ext/intl/php_intl_arginfo.h b/ext/intl/php_intl_arginfo.h index c05ecb7b24973..86899ecb3e76a 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: c32e74bddb55455f69083a302bcaf52f654b1293 */ + * Stub hash: 9b71cd87f05bb7644a98c9855afba4742ac6203c */ 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") @@ -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_after, arginfo_intlcal_after) 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_clear, arginfo_intlcal_clear) ZEND_FE(intlcal_field_difference, arginfo_intlcal_field_difference) diff --git a/ext/intl/tests/calendar_isSet_empty_time.phpt b/ext/intl/tests/calendar_isSet_empty_time.phpt index 0fbecd72b6304..533baffe49f7c 100644 --- a/ext/intl/tests/calendar_isSet_empty_time.phpt +++ b/ext/intl/tests/calendar_isSet_empty_time.phpt @@ -21,7 +21,8 @@ var_dump($intlcal->get(IntlCalendar::FIELD_MINUTE)); 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) int(58) bool(true) diff --git a/ext/intl/tests/calendar_set_basic.phpt b/ext/intl/tests/calendar_set_basic.phpt index b9f4b561b52d9..56017f2bf554b 100644 --- a/ext/intl/tests/calendar_set_basic.phpt +++ b/ext/intl/tests/calendar_set_basic.phpt @@ -16,8 +16,10 @@ var_dump(intlcal_set($intlcal, IntlCalendar::FIELD_DAY_OF_MONTH, 3)); var_dump($intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH)); ?> ---EXPECT-- +--EXPECTF-- bool(true) int(2) + +Deprecated: Function intlcal_set() is deprecated in %s on line %d bool(true) -int(3) \ No newline at end of file +int(3) diff --git a/ext/intl/tests/calendar_set_error.phpt b/ext/intl/tests/calendar_set_error.phpt index 128f4d126922d..d91c9449ac442 100644 --- a/ext/intl/tests/calendar_set_error.phpt +++ b/ext/intl/tests/calendar_set_error.phpt @@ -40,9 +40,16 @@ try { 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 + +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(): 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 + +Deprecated: Function intlcal_set() is deprecated in %s on line %d intlcal_set(): Argument #1 ($calendar) must be of type IntlCalendar, int given diff --git a/ext/intl/tests/calendar_set_variation1.phpt b/ext/intl/tests/calendar_set_variation1.phpt index dae639e298e9b..520c909487351 100644 --- a/ext/intl/tests/calendar_set_variation1.phpt +++ b/ext/intl/tests/calendar_set_variation1.phpt @@ -25,13 +25,18 @@ var_dump($intlcal->getTime(), 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) 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) 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) float(1330559911000) -float(1330559911000) \ No newline at end of file +float(1330559911000) diff --git a/ext/intl/tests/calendar_toDateTime_basic.phpt b/ext/intl/tests/calendar_toDateTime_basic.phpt index 89a848dbb8c2d..2f125672d5034 100644 --- a/ext/intl/tests/calendar_toDateTime_basic.phpt +++ b/ext/intl/tests/calendar_toDateTime_basic.phpt @@ -14,6 +14,7 @@ $dt = $cal->toDateTime(); 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(13) "Europe/Lisbon" From 0b1ddcd4cc7b8f20a83e37c6182db633b66a7ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sat, 18 Nov 2023 23:21:55 +0100 Subject: [PATCH 3/7] Calling IntlGregorianCalendar::__construct() with more than 2 arguments and intlgregcal_create_instance() --- UPGRADING | 5 +++++ ext/intl/calendar/gregoriancalendar_methods.cpp | 8 ++++++++ ext/intl/php_intl.stub.php | 1 + ext/intl/php_intl_arginfo.h | 4 ++-- .../calendar_get_setSkippedWallTimeOption_basic.phpt | 3 ++- ext/intl/tests/calendar_roll_basic.phpt | 7 +++++-- ext/intl/tests/calendar_roll_variation1.phpt | 2 ++ ext/intl/tests/calendar_toDateTime_basic.phpt | 2 +- .../tests/gregoriancalendar___construct_basic.phpt | 5 ++++- .../tests/gregoriancalendar___construct_error.phpt | 11 ++++++++++- .../tests/gregoriancalendar___construct_variant1.phpt | 5 ++++- .../tests/msgfmt_format_intlcalendar_variant2.phpt | 3 ++- .../tests/msgfmt_format_intlcalendar_variant3.phpt | 3 ++- .../tests/msgfmt_format_intlcalendar_variant4.phpt | 3 ++- 14 files changed, 50 insertions(+), 12 deletions(-) diff --git a/UPGRADING b/UPGRADING index 5f172cdc86d6a..f52779625ce47 100644 --- a/UPGRADING +++ b/UPGRADING @@ -136,6 +136,11 @@ PHP 8.4 UPGRADE NOTES . Calling intlcal_set() as well as calling IntlCalendar::set() with more than 2 arguments is deprecated. Use either IntlCalendar::setDate() or IntlCalendar::setDateTime() instead. + . Calling intlgregcal_create_instance() as well as calling + IntlGregorianCalendar::__construct() with more than 2 arguments is + deprecated. Use either IntlGregorianCalendar::createFromDate() or + IntlGregorianCalendar::createFromDateTime() instead. + ======================================== 5. Changed Functions ======================================== diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp index ceee4d2147d92..79975a7e86c95 100644 --- a/ext/intl/calendar/gregoriancalendar_methods.cpp +++ b/ext/intl/calendar/gregoriancalendar_methods.cpp @@ -91,6 +91,14 @@ static void _php_intlgregcal_constructor_body( int variant; intl_error_reset(NULL); + if (is_constructor && ZEND_NUM_ARGS() > 2) { + zend_error(E_DEPRECATED, "Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, " + "use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead"); + if (UNEXPECTED(EG(exception))) { + RETURN_THROWS(); + } + } + // parameter number validation / variant determination if (ZEND_NUM_ARGS() > 6 || zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == FAILURE) { diff --git a/ext/intl/php_intl.stub.php b/ext/intl/php_intl.stub.php index 8eb1d97793076..3bd0b83f0fd27 100644 --- a/ext/intl/php_intl.stub.php +++ b/ext/intl/php_intl.stub.php @@ -278,6 +278,7 @@ function intlcal_get_error_message(IntlCalendar $calendar): string|false {} * @param int $hour * @param int $minute * @param int $second + * @deprecated */ function intlgregcal_create_instance($timezoneOrYear = UNKNOWN, $localeOrMonth = UNKNOWN, $day = UNKNOWN, $hour = UNKNOWN, $minute = UNKNOWN, $second = UNKNOWN): ?IntlGregorianCalendar {} diff --git a/ext/intl/php_intl_arginfo.h b/ext/intl/php_intl_arginfo.h index 86899ecb3e76a..8e9c6e5fa453a 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: 9b71cd87f05bb7644a98c9855afba4742ac6203c */ + * Stub hash: 893419f59d38566a8f6a766829250c18663e339c */ 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") @@ -1021,7 +1021,7 @@ static const zend_function_entry ext_functions[] = { ZEND_FE(intlcal_to_date_time, arginfo_intlcal_to_date_time) ZEND_FE(intlcal_get_error_code, arginfo_intlcal_get_error_code) ZEND_FE(intlcal_get_error_message, arginfo_intlcal_get_error_message) - ZEND_FE(intlgregcal_create_instance, arginfo_intlgregcal_create_instance) + ZEND_DEP_FE(intlgregcal_create_instance, arginfo_intlgregcal_create_instance) ZEND_FE(intlgregcal_set_gregorian_change, arginfo_intlgregcal_set_gregorian_change) ZEND_FE(intlgregcal_get_gregorian_change, arginfo_intlgregcal_get_gregorian_change) ZEND_FE(intlgregcal_is_leap_year, arginfo_intlgregcal_is_leap_year) diff --git a/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt b/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt index d591c293e4458..0e1eb1fe2843c 100644 --- a/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt +++ b/ext/intl/tests/calendar_get_setSkippedWallTimeOption_basic.phpt @@ -42,7 +42,8 @@ var_dump( ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead in %s on line %d int(0) Should be 3h30 int(3) diff --git a/ext/intl/tests/calendar_roll_basic.phpt b/ext/intl/tests/calendar_roll_basic.phpt index 81b8ead1fa15d..3a77bafec3ec5 100644 --- a/ext/intl/tests/calendar_roll_basic.phpt +++ b/ext/intl/tests/calendar_roll_basic.phpt @@ -21,10 +21,13 @@ var_dump($intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH)); //1 ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead in %s on line %d bool(true) int(1) int(1) + +Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead in %s on line %d bool(true) int(1) -int(1) \ No newline at end of file +int(1) diff --git a/ext/intl/tests/calendar_roll_variation1.phpt b/ext/intl/tests/calendar_roll_variation1.phpt index a7cceb94e59f4..a496d6f2e5472 100644 --- a/ext/intl/tests/calendar_roll_variation1.phpt +++ b/ext/intl/tests/calendar_roll_variation1.phpt @@ -20,6 +20,8 @@ var_dump($intlcal->get(IntlCalendar::FIELD_DAY_OF_MONTH)); //28 ?> --EXPECTF-- +Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead in %s on line %d + Deprecated: IntlCalendar::roll(): Passing bool is deprecated, use 1 or -1 instead in %s on line %d bool(true) int(1) diff --git a/ext/intl/tests/calendar_toDateTime_basic.phpt b/ext/intl/tests/calendar_toDateTime_basic.phpt index 2f125672d5034..391d13005c69e 100644 --- a/ext/intl/tests/calendar_toDateTime_basic.phpt +++ b/ext/intl/tests/calendar_toDateTime_basic.phpt @@ -15,6 +15,6 @@ $dt = $cal->toDateTime(); var_dump($dt->format("c"), $dt->getTimeZone()->getName()); ?> --EXPECTF-- -Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated in %s on line %d +Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead in %s on line %d string(25) "2012-05-17T17:35:36+01:00" string(13) "Europe/Lisbon" diff --git a/ext/intl/tests/gregoriancalendar___construct_basic.phpt b/ext/intl/tests/gregoriancalendar___construct_basic.phpt index c31f49c623a0f..8e8240a11a808 100644 --- a/ext/intl/tests/gregoriancalendar___construct_basic.phpt +++ b/ext/intl/tests/gregoriancalendar___construct_basic.phpt @@ -31,7 +31,8 @@ var_dump($intlcal->getLocale(1)); var_dump($intlcal->getType()); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function intlgregcal_create_instance() is deprecated in %s on line %d string(16) "Europe/Amsterdam" string(5) "nl_NL" string(13) "Europe/Lisbon" @@ -40,6 +41,8 @@ string(16) "Europe/Amsterdam" string(5) "pt_PT" string(13) "Europe/Lisbon" string(5) "pt_PT" + +Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead in %s on line %d string(12) "Europe/Paris" string(5) "fr_CA" string(9) "gregorian" diff --git a/ext/intl/tests/gregoriancalendar___construct_error.phpt b/ext/intl/tests/gregoriancalendar___construct_error.phpt index 017cf27307672..e25dd0f1c98e8 100644 --- a/ext/intl/tests/gregoriancalendar___construct_error.phpt +++ b/ext/intl/tests/gregoriancalendar___construct_error.phpt @@ -39,10 +39,19 @@ try { echo $e->getMessage(), "\n"; } ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function intlgregcal_create_instance() is deprecated in %s on line %d Too many arguments + +Deprecated: Function intlgregcal_create_instance() is deprecated in %s on line %d Too many arguments + +Deprecated: Function intlgregcal_create_instance() is deprecated in %s on line %d No variant with 4 arguments (excluding trailing NULLs) + +Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead in %s on line %d No variant with 4 arguments (excluding trailing NULLs) + +Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead in %s on line %d IntlGregorianCalendar::__construct(): Argument #6 ($second) must be of type int, array given IntlGregorianCalendar object is already constructed diff --git a/ext/intl/tests/gregoriancalendar___construct_variant1.phpt b/ext/intl/tests/gregoriancalendar___construct_variant1.phpt index 298381912677f..3590d39308a24 100644 --- a/ext/intl/tests/gregoriancalendar___construct_variant1.phpt +++ b/ext/intl/tests/gregoriancalendar___construct_variant1.phpt @@ -17,10 +17,13 @@ var_dump($intlcal->getTime(), (float)strtotime('2012-02-29 16:07:08') * 1000); var_dump($intlcal->getType()); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Function intlgregcal_create_instance() is deprecated in %s on line %d string(16) "Europe/Amsterdam" float(1330527600000) float(1330527600000) + +Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead in %s on line %d float(1330528028000) float(1330528028000) string(9) "gregorian" diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt index c092661b7849b..3747ab6913184 100644 --- a/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt +++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant2.phpt @@ -24,5 +24,6 @@ echo "msgf2: ", $msgf->format(array($time, 'date')), " ", */ ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead in %s on line %d Quinta-feira, 17 de Maio de 2012 5:35:36 PM ptlis diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt index 2029feb50b60d..fcb841b113691 100644 --- a/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt +++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant3.phpt @@ -25,5 +25,6 @@ echo "msgf2: ", $msgf->format(array($time, 'date')), " ", */ ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead in %s on line %d quinta-feira, 17 de Maio de 2012 5:35:36 da tarde ptlis diff --git a/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt b/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt index be470d3d0d300..e14d30337b775 100644 --- a/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt +++ b/ext/intl/tests/msgfmt_format_intlcalendar_variant4.phpt @@ -29,5 +29,6 @@ echo "msgf2: ", $msgf->format(array($time, 'date')), " ", */ ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Calling IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead in %s on line %d quinta-feira, 17 de maio de 2012 5:35:36 da tarde ptlis From 5b0c4e69c629339c879204319618f4e37f66200c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sun, 19 Nov 2023 17:21:11 +0100 Subject: [PATCH 4/7] Deprecate calling ldap_connect() with more than 2 arguments --- UPGRADING | 4 ++++ ext/ldap/ldap.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/UPGRADING b/UPGRADING index f52779625ce47..b2fd4baf20f84 100644 --- a/UPGRADING +++ b/UPGRADING @@ -141,6 +141,10 @@ PHP 8.4 UPGRADE NOTES deprecated. Use either IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead. +- LDAP: + . Calling ldap_connect() with more than 2 arguments is deprecated. Use + ldap_connect_wallet() instead. + ======================================== 5. Changed Functions ======================================== diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 8c81e3c27f4cb..d3555353d97a5 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -926,8 +926,11 @@ PHP_FUNCTION(ldap_connect) ldap_linkdata *ld; LDAP *ldap = NULL; - if (ZEND_NUM_ARGS() == 2) { - zend_error(E_DEPRECATED, "Usage of ldap_connect with two arguments is deprecated"); + if (ZEND_NUM_ARGS() > 2) { + zend_error(E_DEPRECATED, "Calling ldap_connect() with Oracle-specific arguments is deprecated, " + "use ldap_connect_wallet() instead"); + } else if (ZEND_NUM_ARGS() == 2) { + zend_error(E_DEPRECATED, "Usage of ldap_connect with two arguments is deprecated"); } #ifdef HAVE_ORALDAP From e5f47c76f2920bf487e89f8c5ea352509069ae3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sun, 19 Nov 2023 17:42:54 +0100 Subject: [PATCH 5/7] Deprecate calling ldap_exop() with more than 4 arguments --- UPGRADING | 2 ++ ext/ldap/ldap.c | 7 +++++++ ext/ldap/tests/ldap_exop.phpt | 3 +++ 3 files changed, 12 insertions(+) diff --git a/UPGRADING b/UPGRADING index b2fd4baf20f84..62c2a01800436 100644 --- a/UPGRADING +++ b/UPGRADING @@ -144,6 +144,8 @@ PHP 8.4 UPGRADE NOTES - LDAP: . Calling ldap_connect() with more than 2 arguments is deprecated. Use ldap_connect_wallet() instead. + . Calling ldap_exop() with more than 4 arguments is deprecated. Use + ldap_exop_sync() instead. ======================================== 5. Changed Functions diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index d3555353d97a5..657efb6f3a3f1 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -3898,6 +3898,13 @@ static void php_ldap_exop(INTERNAL_FUNCTION_PARAMETERS, bool force_sync) { LDAPControl **lserverctrls = NULL; int rc, msgid; + if (force_sync == false && ZEND_NUM_ARGS() > 4) { + zend_error(E_DEPRECATED, "Calling ldap_exop() with more than 4 arguments is deprecated, use ldap_exop_sync() instead"); + if (UNEXPECTED(EG(exception))) { + RETURN_THROWS(); + } + } + if (zend_parse_parameters(ZEND_NUM_ARGS(), "OS|S!a!zz", &link, ldap_link_ce, &reqoid, &reqdata, &serverctrls, &retdata, &retoid) != SUCCESS) { RETURN_THROWS(); } diff --git a/ext/ldap/tests/ldap_exop.phpt b/ext/ldap/tests/ldap_exop.phpt index 06e870d305baa..f4b8f60d2eb98 100644 --- a/ext/ldap/tests/ldap_exop.phpt +++ b/ext/ldap/tests/ldap_exop.phpt @@ -68,6 +68,9 @@ $link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version); remove_dummy_data($link, $base); ?> --EXPECTF-- +Deprecated: Calling ldap_exop() with more than 4 arguments is deprecated, use ldap_exop_sync() instead in %s on line %d + +Deprecated: Calling ldap_exop() with more than 4 arguments is deprecated, use ldap_exop_sync() instead in %s on line %d bool(true) string(%d) "dn:%s" string(0) "" From 4fea8d313806423997e3be8396f2ce5631414bd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Sun, 19 Nov 2023 20:57:18 +0100 Subject: [PATCH 6/7] Deprecate calling pg_fetch_result(), pg_field_prtlen(), and pg_field_is_null() with 2 arguments --- UPGRADING | 8 ++++++++ ext/pgsql/pgsql.c | 17 +++++++++++++++++ ext/pgsql/tests/03sync_query.phpt | 16 ++++++++-------- ext/pgsql/tests/04async_query.phpt | 5 ++++- ext/pgsql/tests/24sync_query_prepared.phpt | 4 ++-- ext/pgsql/tests/25async_query_params.phpt | 4 ++-- ext/pgsql/tests/26async_query_prepared.phpt | 4 ++-- ext/pgsql/tests/30nb_async_query_params.phpt | 4 ++-- ext/pgsql/tests/31nb_async_query_prepared.phpt | 5 ++++- ext/pgsql/tests/bug37100.phpt | 5 ++++- ext/pgsql/tests/bug76548.phpt | 2 +- 11 files changed, 54 insertions(+), 20 deletions(-) diff --git a/UPGRADING b/UPGRADING index 62c2a01800436..f9634ceb0753d 100644 --- a/UPGRADING +++ b/UPGRADING @@ -147,6 +147,14 @@ PHP 8.4 UPGRADE NOTES . Calling ldap_exop() with more than 4 arguments is deprecated. Use ldap_exop_sync() instead. +- PgSQL: + . Calling pgsql_fetch_result() with 2 arguments is deprecated. Use the + 3-parameter signature with a null $row parameter instead. + . Calling pg_field_prtlen() with 2 arguments is deprecated. Use the + 3-parameter signature with a null $row parameter instead. + . Calling pg_field_is_null() with 2 arguments is deprecated. Use the + 3-parameter signature with a null $row parameter instead. + ======================================== 5. Changed Functions ======================================== diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 7e94e2045b5d2..fdb7a386b8f57 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -1698,6 +1698,14 @@ PHP_FUNCTION(pg_fetch_result) int pgsql_row; if (ZEND_NUM_ARGS() == 2) { + if (zend_string_equals_literal(EX(func)->common.function_name, "pg_fetch_result")) { + zend_error(E_DEPRECATED, "Calling pg_fetch_result() with 2 arguments is deprecated, " + "use the 3-parameter signature with a null $row parameter instead"); + if (UNEXPECTED(EG(exception))) { + RETURN_THROWS(); + } + } + ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_OBJECT_OF_CLASS(result, pgsql_result_ce) Z_PARAM_STR_OR_LONG(field_name, field_offset) @@ -2009,6 +2017,15 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type, bo int pgsql_row; if (ZEND_NUM_ARGS() == 2) { + if (nullable_row) { + zend_error(E_DEPRECATED, "Calling %s() with 2 arguments is deprecated, " + "use the 3-parameter signature with a null $row parameter instead", + ZSTR_VAL(EX(func)->common.function_name)); + if (UNEXPECTED(EG(exception))) { + RETURN_THROWS(); + } + } + ZEND_PARSE_PARAMETERS_START(2, 2) Z_PARAM_OBJECT_OF_CLASS(result, pgsql_result_ce) Z_PARAM_STR_OR_LONG(field_name, field_offset) diff --git a/ext/pgsql/tests/03sync_query.phpt b/ext/pgsql/tests/03sync_query.phpt index 2a511502f4a4a..e71f77d3a527c 100644 --- a/ext/pgsql/tests/03sync_query.phpt +++ b/ext/pgsql/tests/03sync_query.phpt @@ -89,21 +89,21 @@ pg_field_name($result, 0); pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); -pg_field_prtlen($result, 0); -pg_field_is_null($result, 0); +pg_field_prtlen($result, null, 0); +pg_field_is_null($result, null, 0); try { - pg_field_is_null($result, -1); + pg_field_is_null($result, null, -1); } catch (ValueError $e) { echo $e->getMessage(), "\n"; } try { - pg_field_is_null($result, 3); + pg_field_is_null($result, null, 3); } catch (ValueError $e) { echo $e->getMessage(), "\n"; } try { - pg_field_is_null($result, "unknown"); + pg_field_is_null($result, null, "unknown"); } catch (ValueError $e) { echo $e->getMessage(), "\n"; } @@ -151,9 +151,9 @@ Argument #3 must be less than the number of fields for this result set Argument #3 must be a field name from this result set pg_fetch_all_columns(): Argument #2 ($field) must be greater than or equal to 0 pg_fetch_all_columns(): Argument #2 ($field) must be less than the number of fields for this result set -Argument #2 must be greater than or equal to 0 -Argument #2 must be less than the number of fields for this result set -Argument #2 must be a field name from this result set +Argument #3 must be greater than or equal to 0 +Argument #3 must be less than the number of fields for this result set +Argument #3 must be a field name from this result set pg_field_name(): Argument #2 ($field) must be greater than or equal to 0 pg_field_name(): Argument #2 ($field) must be less than the number of fields for this result set pg_field_table(): Argument #2 ($field) must be greater than or equal to 0 diff --git a/ext/pgsql/tests/04async_query.phpt b/ext/pgsql/tests/04async_query.phpt index 70a5f47c3f270..4a55329b505d1 100644 --- a/ext/pgsql/tests/04async_query.phpt +++ b/ext/pgsql/tests/04async_query.phpt @@ -74,5 +74,8 @@ $table_name = "table_04async_query"; $db = pg_connect($conn_str); pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Calling pg_field_prtlen() with 2 arguments is deprecated, use the 3-parameter signature with a null $row parameter instead in %s on line %d + +Deprecated: Calling pg_field_is_null() with 2 arguments is deprecated, use the 3-parameter signature with a null $row parameter instead in %s on line %d OK diff --git a/ext/pgsql/tests/24sync_query_prepared.phpt b/ext/pgsql/tests/24sync_query_prepared.phpt index bafb182827303..07baffb0c79f1 100644 --- a/ext/pgsql/tests/24sync_query_prepared.phpt +++ b/ext/pgsql/tests/24sync_query_prepared.phpt @@ -49,8 +49,8 @@ pg_field_name($result, 0); pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); -pg_field_prtlen($result, 0); -pg_field_is_null($result, 0); +pg_field_prtlen($result, null, 0); +pg_field_is_null($result, null, 0); $result = pg_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);"); pg_result_error($result); diff --git a/ext/pgsql/tests/25async_query_params.phpt b/ext/pgsql/tests/25async_query_params.phpt index 26531f991a849..48ed795ae7211 100644 --- a/ext/pgsql/tests/25async_query_params.phpt +++ b/ext/pgsql/tests/25async_query_params.phpt @@ -54,8 +54,8 @@ pg_field_name($result, 0); pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); -pg_field_prtlen($result, 0); -pg_field_is_null($result, 0); +pg_field_prtlen($result, null, 0); +pg_field_is_null($result, null, 0); if (!pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC"))) { diff --git a/ext/pgsql/tests/26async_query_prepared.phpt b/ext/pgsql/tests/26async_query_prepared.phpt index 31b53f531a394..842d1b96e8fb1 100644 --- a/ext/pgsql/tests/26async_query_prepared.phpt +++ b/ext/pgsql/tests/26async_query_prepared.phpt @@ -68,8 +68,8 @@ pg_field_name($result, 0); pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); -pg_field_prtlen($result, 0); -pg_field_is_null($result, 0); +pg_field_prtlen($result, null, 0); +pg_field_is_null($result, null, 0); if (!pg_send_prepare($db, "php_test2", "INSERT INTO ".$table_name." VALUES (\$1, \$2);")) { diff --git a/ext/pgsql/tests/30nb_async_query_params.phpt b/ext/pgsql/tests/30nb_async_query_params.phpt index 937da93d02b35..650ef552afa61 100644 --- a/ext/pgsql/tests/30nb_async_query_params.phpt +++ b/ext/pgsql/tests/30nb_async_query_params.phpt @@ -55,8 +55,8 @@ pg_field_name($result, 0); pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); -pg_field_prtlen($result, 0); -pg_field_is_null($result, 0); +pg_field_prtlen($result, null, 0); +pg_field_is_null($result, null, 0); $sent = pg_send_query_params($db, "INSERT INTO ".$table_name." VALUES (\$1, \$2);", array(9999, "A'BC")); diff --git a/ext/pgsql/tests/31nb_async_query_prepared.phpt b/ext/pgsql/tests/31nb_async_query_prepared.phpt index 50161827a9694..7d4b8a31d8155 100644 --- a/ext/pgsql/tests/31nb_async_query_prepared.phpt +++ b/ext/pgsql/tests/31nb_async_query_prepared.phpt @@ -114,5 +114,8 @@ $table_name = "table_31nb_async_query_prepared"; $db = pg_connect($conn_str); pg_query($db, "DROP TABLE IF EXISTS {$table_name}"); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Calling pg_field_prtlen() with 2 arguments is deprecated, use the 3-parameter signature with a null $row parameter instead in %s on line %d + +Deprecated: Calling pg_field_is_null() with 2 arguments is deprecated, use the 3-parameter signature with a null $row parameter instead in %s on line %d OK diff --git a/ext/pgsql/tests/bug37100.phpt b/ext/pgsql/tests/bug37100.phpt index e67fb77bc3317..6aac2d05709b3 100644 --- a/ext/pgsql/tests/bug37100.phpt +++ b/ext/pgsql/tests/bug37100.phpt @@ -43,8 +43,11 @@ $table_name = 'table_bug37100'; $db = pg_connect($conn_str); pg_query("DROP TABLE IF EXISTS {$table_name}"); ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Calling pg_fetch_result() with 2 arguments is deprecated, use the 3-parameter signature with a null $row parameter instead in %s on line %d string(24) "\001\003\252\000\010\022" string(12) "0103aa000812" + +Deprecated: Calling pg_fetch_result() with 2 arguments is deprecated, use the 3-parameter signature with a null $row parameter instead in %s on line %d int(6) string(12) "0103aa000812" diff --git a/ext/pgsql/tests/bug76548.phpt b/ext/pgsql/tests/bug76548.phpt index 942c3f212d4ff..ebaeeeb369055 100644 --- a/ext/pgsql/tests/bug76548.phpt +++ b/ext/pgsql/tests/bug76548.phpt @@ -12,7 +12,7 @@ $conn = pg_connect($conn_str); $result = pg_query($conn, 'SELECT v FROM (VALUES (1), (2), (3)) AS t(v)'); -while ($value = pg_fetch_result($result, 0)) { +while ($value = pg_fetch_result($result, null, 0)) { var_dump($value); // should be 1, 2 then 3. } From ea7865be5824cde860e3352434341d58405c0ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Kocsis?= Date: Mon, 20 Nov 2023 11:34:40 +0100 Subject: [PATCH 7/7] Deprecate calling ReflectionMethod::__construct() with 1 argument --- UPGRADING | 4 ++++ ext/reflection/php_reflection.c | 8 ++++++++ ext/reflection/tests/008.phpt | 13 ++++++++++++- .../tests/ReflectionMethod_constructor_basic.phpt | 2 +- .../tests/ReflectionMethod_constructor_error1.phpt | 12 ++++++++++++ .../tests/ReflectionMethod_getModifiers_basic.phpt | 2 +- .../ReflectionMethod_getStaticVariables_basic.phpt | 8 ++++---- .../tests/ReflectionMethod_invokeArgs_error3.phpt | 4 ++-- .../tests/ReflectionMethod_invoke_basic.phpt | 6 +++--- tests/classes/autoload_014.phpt | 2 +- 10 files changed, 48 insertions(+), 13 deletions(-) diff --git a/UPGRADING b/UPGRADING index f9634ceb0753d..634dd7786b7bc 100644 --- a/UPGRADING +++ b/UPGRADING @@ -155,6 +155,10 @@ PHP 8.4 UPGRADE NOTES . Calling pg_field_is_null() with 2 arguments is deprecated. Use the 3-parameter signature with a null $row parameter instead. +- Reflection: + . Calling ReflectionMethod::__construct() with 1 argument is deprecated. + Use ReflectionMethod::createFromMethodName() instead. + ======================================== 5. Changed Functions ======================================== diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index a725573aa9076..53e978604ad91 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -3204,6 +3204,14 @@ static void instantiate_reflection_method(INTERNAL_FUNCTION_PARAMETERS, bool is_ zend_function *mptr; if (is_constructor) { + if (ZEND_NUM_ARGS() == 1) { + zend_error(E_DEPRECATED, "Calling ReflectionMethod::__construct() with 1 argument is deprecated, " + "use ReflectionMethod::createFromMethodName() instead"); + if (UNEXPECTED(EG(exception))) { + RETURN_THROWS(); + } + } + ZEND_PARSE_PARAMETERS_START(1, 2) Z_PARAM_OBJ_OR_STR(arg1_obj, arg1_str) Z_PARAM_OPTIONAL diff --git a/ext/reflection/tests/008.phpt b/ext/reflection/tests/008.phpt index 91227be7dd302..64866bbe6993a 100644 --- a/ext/reflection/tests/008.phpt +++ b/ext/reflection/tests/008.phpt @@ -32,17 +32,28 @@ foreach ($a as $key=>$val) { echo "Done\n"; ?> ---EXPECT-- +--EXPECTF-- +Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d string(90) "ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name" string(91) "ReflectionMethod::createFromMethodName(): Argument #1 ($method) must be a valid method name" + +Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d string(90) "ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name" string(91) "ReflectionMethod::createFromMethodName(): Argument #1 ($method) must be a valid method name" + +Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d string(23) "Class "" does not exist" string(23) "Class "" does not exist" + +Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d string(24) "Class "a" does not exist" string(24) "Class "a" does not exist" + +Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d string(23) "Class "" does not exist" string(23) "Class "" does not exist" + +Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d string(24) "Class "a" does not exist" string(24) "Class "a" does not exist" string(23) "Class "" does not exist" diff --git a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt index 5aa9909858c4d..3d26d682a56bf 100644 --- a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt @@ -10,7 +10,7 @@ class NewCtor { } echo "New-style constructor:\n"; -$methodInfo = new ReflectionMethod("NewCtor::__construct"); +$methodInfo = new ReflectionMethod("NewCtor", "__construct"); var_dump($methodInfo->isConstructor()); class ExtendsNewCtor extends NewCtor { diff --git a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt index 8c5bd7139ceaa..9a1e340d83a33 100644 --- a/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt +++ b/ext/reflection/tests/ReflectionMethod_constructor_error1.phpt @@ -65,11 +65,15 @@ try { ?> --EXPECTF-- Wrong type of argument (bool): + +Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name in %s:%d Stack trace: #0 %s ReflectionMethod->__construct('1') #1 {main} Wrong type of argument (int): + +Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name in %s:%d Stack trace: #0 %s ReflectionMethod->__construct('3') @@ -85,18 +89,26 @@ Stack trace: #0 %s ReflectionMethod->__construct('TestClass', '1') #1 {main} No method given: + +Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d ReflectionException: ReflectionMethod::__construct(): Argument #1 ($objectOrMethod) must be a valid method name in %s:%d Stack trace: #0 %s ReflectionMethod->__construct('TestClass') #1 {main} Class and Method in same string, bad method name: + +Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d ReflectionException: Method TestClass::foop::dedoop() does not exist in %s:%d Stack trace: #0 %s ReflectionMethod->__construct('TestClass::foop...') #1 {main} Class and Method in same string, bad class name: + +Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d ReflectionException: Class "TestCla" does not exist in %s:%d Stack trace: #0 %s ReflectionMethod->__construct('TestCla::foo') #1 {main} Class and Method in same string (ok): + +Deprecated: Calling ReflectionMethod::__construct() with 1 argument is deprecated, use ReflectionMethod::createFromMethodName() instead in %s on line %d diff --git a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt index c5fe6aa41a2f3..e66ec73937944 100644 --- a/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_getModifiers_basic.phpt @@ -87,7 +87,7 @@ reflectMethodModifiers("DerivedClass"); reflectMethodModifiers("TestInterface"); reflectMethodModifiers("AbstractClass"); -$a = new ReflectionMethod('ReflectionMethod::getModifiers'); +$a = new ReflectionMethod('ReflectionMethod', 'getModifiers'); echo "ReflectionMethod::getModifiers() modifiers:\n"; printf("0x%08x\n", $a->getModifiers()); diff --git a/ext/reflection/tests/ReflectionMethod_getStaticVariables_basic.phpt b/ext/reflection/tests/ReflectionMethod_getStaticVariables_basic.phpt index 4c50b96b9d867..91b933058f120 100644 --- a/ext/reflection/tests/ReflectionMethod_getStaticVariables_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_getStaticVariables_basic.phpt @@ -21,19 +21,19 @@ class TestClass { } echo "Public method:\n"; -$methodInfo = new ReflectionMethod('TestClass::foo'); +$methodInfo = new ReflectionMethod('TestClass', 'foo'); var_dump($methodInfo->getStaticVariables()); echo "\nPrivate method:\n"; -$methodInfo = new ReflectionMethod('TestClass::bar'); +$methodInfo = new ReflectionMethod('TestClass', 'bar'); var_dump($methodInfo->getStaticVariables()); echo "\nMethod with no static variables:\n"; -$methodInfo = new ReflectionMethod('TestClass::noStatics'); +$methodInfo = new ReflectionMethod('TestClass', 'noStatics'); var_dump($methodInfo->getStaticVariables()); echo "\nInternal Method:\n"; -$methodInfo = new ReflectionMethod('ReflectionClass::getName'); +$methodInfo = new ReflectionMethod('ReflectionClass', 'getName'); var_dump($methodInfo->getStaticVariables()); ?> diff --git a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt index b4a4002e30700..124f728052e26 100644 --- a/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt +++ b/ext/reflection/tests/ReflectionMethod_invokeArgs_error3.phpt @@ -35,7 +35,7 @@ $testClassInstance->prop = "Hello"; $foo = new ReflectionMethod($testClassInstance, 'foo'); $staticMethod = ReflectionMethod::createFromMethodName('TestClass::staticMethod'); -$privateMethod = new ReflectionMethod("TestClass::privateMethod"); +$privateMethod = new ReflectionMethod("TestClass", "privateMethod"); echo "\nNon-instance:\n"; try { @@ -52,7 +52,7 @@ echo "\nPrivate method:\n"; var_dump($privateMethod->invokeArgs($testClassInstance, array())); echo "\nAbstract method:\n"; -$abstractMethod = new ReflectionMethod("AbstractClass::foo"); +$abstractMethod = new ReflectionMethod("AbstractClass", "foo"); try { $abstractMethod->invokeArgs($testClassInstance, array()); } catch (ReflectionException $e) { diff --git a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt index 67b37411b4216..66f3c50da027d 100644 --- a/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_invoke_basic.phpt @@ -40,9 +40,9 @@ abstract class AbstractClass { $foo = new ReflectionMethod('TestClass', 'foo'); $methodWithArgs = new ReflectionMethod('TestClass', 'methodWithArgs'); -$staticMethod = new ReflectionMethod('TestClass::staticMethod'); -$privateMethod = new ReflectionMethod("TestClass::privateMethod"); -$methodThatThrows = new ReflectionMethod("TestClass::willThrow"); +$staticMethod = new ReflectionMethod('TestClass', 'staticMethod'); +$privateMethod = new ReflectionMethod('TestClass', 'privateMethod'); +$methodThatThrows = new ReflectionMethod('TestClass', 'willThrow'); $testClassInstance = new TestClass(); $testClassInstance->prop = "Hello"; diff --git a/tests/classes/autoload_014.phpt b/tests/classes/autoload_014.phpt index 13f16f8264061..eaba7f05c1217 100644 --- a/tests/classes/autoload_014.phpt +++ b/tests/classes/autoload_014.phpt @@ -8,7 +8,7 @@ spl_autoload_register(function ($name) { }); try { - new ReflectionMethod("UndefC::test"); + new ReflectionMethod("UndefC", "test"); } catch (ReflectionException $e) { echo $e->getMessage();