Skip to content

Commit 2792802

Browse files
Replace @deprecated with #[\Deprecated] for internal constants
Only covers constants declared via stub files, others will be handled separately in a later commit. Does not include the intl extension, since that had some errors relating to the cpp code; that extension will be updated separately. Also fix an undefined variable warning in gen_stub.php.
1 parent 8f3cdf6 commit 2792802

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+641
-150
lines changed

build/gen_stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5317,7 +5317,7 @@ static function (ConstInfo $constInfo) use ($allConstInfos, $phpVersionIdMinimum
53175317
$constName = str_replace('\\', '\\\\', $constInfo->name->__toString());
53185318
$constVarName = 'const_' . $constName;
53195319

5320-
$code .= "\tzend_constant *$constVarName = zend_hash_str_find_ptr(EG(zend_constants), \"" . $constName . "\", sizeof(\"" . $constName . "\") - 1);\n";
5320+
$code = "\tzend_constant *$constVarName = zend_hash_str_find_ptr(EG(zend_constants), \"" . $constName . "\", sizeof(\"" . $constName . "\") - 1);\n";
53215321
foreach ($constInfo->attributes as $key => $attribute) {
53225322
$code .= $attribute->generateCode(
53235323
"zend_add_global_constant_attribute($constVarName",

ext/curl/curl.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
const CURLOPT_AUTOREFERER = UNKNOWN;
1414
/**
1515
* @var int
16-
* @deprecated has no effect since 5.1.2
1716
* @cvalue CURLOPT_BINARYTRANSFER
1817
*/
18+
#[\Deprecated(since: '8.4', message: 'as it had no effect since 5.1.2')]
1919
const CURLOPT_BINARYTRANSFER = UNKNOWN;
2020
/**
2121
* @var int

ext/curl/curl_arginfo.h

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

ext/curl/interface.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
6666
#endif
6767

68+
#include "zend_attributes.h"
6869
#include "curl_arginfo.h"
6970

7071
ZEND_DECLARE_MODULE_GLOBALS(curl)

ext/curl/tests/bug46711.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var_dump($opt); // with this bug, $opt[58] becomes NULL
2121

2222
?>
2323
--EXPECTF--
24-
Deprecated: Constant CURLOPT_BINARYTRANSFER is deprecated in %s on line %d
24+
Deprecated: Constant CURLOPT_BINARYTRANSFER is deprecated since 8.4, as it had no effect since 5.1.2 in %s on line %d
2525
array(2) {
2626
[58]=>
2727
bool(true)

ext/date/php_date.stub.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,22 +83,22 @@
8383
/**
8484
* @var int
8585
* @cvalue SUNFUNCS_RET_TIMESTAMP
86-
* @deprecated
8786
*/
87+
#[\Deprecated(since: '8.4', message: 'as date_sunrise() and date_sunset() were deprecated in 8.1')]
8888
const SUNFUNCS_RET_TIMESTAMP = UNKNOWN;
8989

9090
/**
9191
* @var int
9292
* @cvalue SUNFUNCS_RET_STRING
93-
* @deprecated
9493
*/
94+
#[\Deprecated(since: '8.4', message: 'as date_sunrise() and date_sunset() were deprecated in 8.1')]
9595
const SUNFUNCS_RET_STRING = UNKNOWN;
9696

9797
/**
9898
* @var int
9999
* @cvalue SUNFUNCS_RET_DOUBLE
100-
* @deprecated
101100
*/
101+
#[\Deprecated(since: '8.4', message: 'as date_sunrise() and date_sunset() were deprecated in 8.1')]
102102
const SUNFUNCS_RET_DOUBLE = UNKNOWN;
103103

104104
function strtotime(string $datetime, ?int $baseTimestamp = null): int|false {}

ext/date/php_date_arginfo.h

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

ext/date/tests/date_sunrise_and_sunset_basic.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ var_dump(gettype(date_sunset(time())));
2525
--EXPECTF--
2626
Basic test for date_sunrise() and date_sunset()
2727

28-
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
28+
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d
2929

3030
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
3131
%s %s %d %d, sunrise time : %d:%d
3232

33-
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
33+
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d
3434

3535
Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
3636
%s %s %d %d, sunset time : %d:%d

ext/date/tests/gh14732.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ date_sun_info(): Argument #2 ($latitude) must be finite
3131
date_sun_info(): Argument #3 ($longitude) must be finite
3232
date_sun_info(): Argument #3 ($longitude) must be finite
3333

34-
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
34+
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d
3535

3636
Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
3737
bool(false)
3838

39-
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
39+
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d
4040

4141
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
4242
bool(false)

ext/date/tests/gh16454.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ var_dump(date_sunset(0, SUNFUNCS_RET_STRING, 61, -150, 90, PHP_FLOAT_MAX));
88
var_dump(date_sunset(0, SUNFUNCS_RET_STRING, 61, -150, 90, -PHP_FLOAT_MAX));
99
?>
1010
--EXPECTF--
11-
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
11+
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d
1212

1313
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
1414
bool(false)
1515

16-
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
16+
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d
1717

1818
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
1919
bool(false)
2020

21-
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
21+
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d
2222

2323
Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
2424
bool(false)
2525

26-
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
26+
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d
2727

2828
Deprecated: Function date_sunset() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
2929
bool(false)

ext/date/tests/gh18481.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ foreach ([-NAN, NAN, INF, -INF] as $offset) {
88
}
99
?>
1010
--EXPECTF--
11-
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
11+
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d
1212

1313
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
1414
bool(false)
1515

16-
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
16+
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d
1717

1818
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
1919
bool(false)
2020

21-
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
21+
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d
2222

2323
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
2424
bool(false)
2525

26-
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in %s on line %d
26+
Deprecated: Constant SUNFUNCS_RET_STRING is deprecated since 8.4, as date_sunrise() and date_sunset() were deprecated in 8.1 in %s on line %d
2727

2828
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in %s on line %d
2929
bool(false)

ext/dom/php_dom.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "php.h"
2424
#if defined(HAVE_LIBXML) && defined(HAVE_DOM)
2525
#include "zend_enum.h"
26+
#include "zend_attributes.h"
2627
#include "php_dom.h"
2728
#include "nodelist.h"
2829
#include "html_collection.h"

ext/dom/php_dom.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@
147147

148148
/**
149149
* @var int
150-
* @deprecated is no longer used since 8.4
151150
* @cvalue PHP_ERR
152151
*/
152+
#[\Deprecated(since: '8.4', message: 'as it is no longer used')]
153153
const DOM_PHP_ERR = UNKNOWN;
154154
/**
155155
* @var int

ext/dom/php_dom_arginfo.h

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

ext/dom/tests/DOM_PHP_ERR_deprecated.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ dom
77
var_dump(DOM_PHP_ERR);
88
?>
99
--EXPECTF--
10-
Deprecated: Constant DOM_PHP_ERR is deprecated in %s on line %d
10+
Deprecated: Constant DOM_PHP_ERR is deprecated since 8.4, as it is no longer used in %s on line %d
1111
int(0)

ext/enchant/enchant.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
/**
66
* @var int
77
* @cvalue PHP_ENCHANT_MYSPELL
8-
* @deprecated
98
*/
9+
#[\Deprecated(since: '8.0', message: 'as enchant_broker_get_dict_path() and enchant_broker_set_dict_path() are deprecated')]
1010
const ENCHANT_MYSPELL = UNKNOWN;
1111
/**
1212
* @var int
1313
* @cvalue PHP_ENCHANT_ISPELL
14-
* @deprecated
1514
*/
15+
#[\Deprecated(since: '8.0', message: 'as enchant_broker_get_dict_path() and enchant_broker_set_dict_path() are deprecated')]
1616
const ENCHANT_ISPELL = UNKNOWN;
1717
#ifdef HAVE_ENCHANT_GET_VERSION
1818
/**

0 commit comments

Comments
 (0)