Skip to content

Commit e5d24eb

Browse files
committed
Revert all property deprecations and new constants
1 parent 14f78c1 commit e5d24eb

11 files changed

+26
-127
lines changed

ext/mysqli/mysqli.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,6 @@ static PHP_GINIT_FUNCTION(mysqli);
4949

5050
#define ERROR_ARG_POS(arg_num) (getThis() ? (arg_num-1) : (arg_num))
5151

52-
#define REGISTER_MYSQLI_DRIVER_CLASS_CONST_LONG(const_name, value) \
53-
zend_declare_class_constant_long(mysqli_driver_class_entry, const_name, sizeof(const_name)-1, (zend_long)value);
54-
55-
#define REGISTER_MYSQLI_DRIVER_CLASS_CONST_STRING(const_name, value) \
56-
zend_declare_class_constant_stringl(mysqli_driver_class_entry, const_name, sizeof(const_name)-1, value, sizeof(value)-1);
57-
58-
#define REGISTER_MYSQLI_CLASS_CONST_LONG(const_name, value) \
59-
zend_declare_class_constant_long(mysqli_link_class_entry, const_name, sizeof(const_name)-1, (zend_long)value);
60-
61-
#define REGISTER_MYSQLI_CLASS_CONST_STRING(const_name, value) \
62-
zend_declare_class_constant_stringl(mysqli_link_class_entry, const_name, sizeof(const_name)-1, value, sizeof(value)-1);
63-
6452
static HashTable classes;
6553
static zend_object_handlers mysqli_object_handlers;
6654
static zend_object_handlers mysqli_object_driver_handlers;
@@ -789,12 +777,6 @@ PHP_MINIT_FUNCTION(mysqli)
789777
REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_RELEASE", TRANS_COR_RELEASE, CONST_CS | CONST_PERSISTENT);
790778
REGISTER_LONG_CONSTANT("MYSQLI_TRANS_COR_NO_RELEASE", TRANS_COR_NO_RELEASE, CONST_CS | CONST_PERSISTENT);
791779

792-
REGISTER_MYSQLI_DRIVER_CLASS_CONST_LONG("CLIENT_VERSION", MYSQL_VERSION_ID);
793-
REGISTER_MYSQLI_DRIVER_CLASS_CONST_STRING("CLIENT_INFO", MYSQL_SERVER_VERSION);
794-
795-
REGISTER_MYSQLI_CLASS_CONST_LONG("CLIENT_VERSION", MYSQL_VERSION_ID);
796-
REGISTER_MYSQLI_CLASS_CONST_STRING("CLIENT_INFO", MYSQL_SERVER_VERSION);
797-
798780

799781
#ifdef MYSQLI_USE_MYSQLND
800782
mysqlnd_reverse_api_register_api(&mysqli_reverse_api);

ext/mysqli/mysqli.stub.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44

55
final class mysqli_driver
66
{
7-
/** @deprecated 8.1.0 */
87
public string $client_info;
98

10-
/** @deprecated 8.1.0 */
119
public int $client_version;
1210

1311
public int $driver_version;
@@ -23,10 +21,8 @@ class mysqli
2321
{
2422
public int|string $affected_rows;
2523

26-
/** @deprecated 8.1.0 */
2724
public string $client_info;
2825

29-
/** @deprecated 8.1.0 */
3026
public int $client_version;
3127

3228
public int $connect_errno;

ext/mysqli/mysqli_driver.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ static int driver_report_write(mysqli_object *obj, zval *value)
6262
/* {{{ property driver_client_version_read */
6363
static int driver_client_version_read(mysqli_object *obj, zval *retval, bool quiet)
6464
{
65-
if (quiet) {
66-
return FAILURE;
67-
}
68-
zend_error(E_DEPRECATED, "Property access to the client_version constant is deprecated");
6965
ZVAL_LONG(retval, mysql_get_client_version());
7066
return SUCCESS;
7167
}
@@ -74,10 +70,6 @@ static int driver_client_version_read(mysqli_object *obj, zval *retval, bool qui
7470
/* {{{ property driver_client_info_read */
7571
static int driver_client_info_read(mysqli_object *obj, zval *retval, bool quiet)
7672
{
77-
if (quiet) {
78-
return FAILURE;
79-
}
80-
zend_error(E_DEPRECATED, "Property access to the client_info constant is deprecated");
8173
ZVAL_STRING(retval, (char *)mysql_get_client_info());
8274
return SUCCESS;
8375
}

ext/mysqli/mysqli_prop.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ static int __func(mysqli_object *obj, zval *retval, bool quiet)\
128128
/* {{{ property link_client_version_read */
129129
static int link_client_version_read(mysqli_object *obj, zval *retval, bool quiet)
130130
{
131-
if (quiet) {
132-
return FAILURE;
133-
}
134-
zend_error(E_DEPRECATED, "Property access to the client_version constant is deprecated");
135131
ZVAL_LONG(retval, MYSQL_VERSION_ID);
136132

137133
return SUCCESS;
@@ -141,10 +137,6 @@ static int link_client_version_read(mysqli_object *obj, zval *retval, bool quiet
141137
/* {{{ property link_client_info_read */
142138
static int link_client_info_read(mysqli_object *obj, zval *retval, bool quiet)
143139
{
144-
if (quiet) {
145-
return FAILURE;
146-
}
147-
zend_error(E_DEPRECATED, "Property access to the client_info constant is deprecated");
148140
ZVAL_STRING(retval, MYSQL_SERVER_VERSION);
149141

150142
return SUCCESS;

ext/mysqli/tests/bug34810.phpt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ mysqli_close($link);
6363
object(mysqli)#%d (%d) {
6464
["affected_rows"]=>
6565
int(0)
66+
["client_info"]=>
67+
string(%d) "%s"
68+
["client_version"]=>
69+
int(%d)
6670
["connect_errno"]=>
6771
int(0)
6872
["connect_error"]=>
@@ -96,6 +100,10 @@ object(mysqli)#%d (%d) {
96100
int(0)
97101
}
98102
object(mysqli)#%d (%d) {
103+
["client_info"]=>
104+
string(%d) "%s"
105+
["client_version"]=>
106+
int(%d)
99107
["connect_errno"]=>
100108
int(0)
101109
["connect_error"]=>

ext/mysqli/tests/mysqli_class_mysqli_driver_interface.phpt

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,13 @@ foreach ($variables as $var) {
4646
printf("%s\n", $var);
4747
}
4848

49-
printf("\nClass constants:\n");
50-
$refl = new ReflectionClass($driver::class);
51-
var_dump($refl->getConstants());
52-
5349
printf("\nMagic, magic properties:\n");
5450

55-
$client_info = $driver->client_info;
56-
assert(mysqli_get_client_info() === $client_info);
57-
printf("driver->client_info = '%s'\n", $client_info);
51+
assert(mysqli_get_client_info() === $driver->client_info);
52+
printf("driver->client_info = '%s'\n", $driver->client_info);
5853

59-
$client_version = $driver->client_version;
60-
assert(mysqli_get_client_version() === $client_version);
61-
printf("driver->client_version = '%s'\n", $client_version);
54+
assert(mysqli_get_client_version() === $driver->client_version);
55+
printf("driver->client_version = '%s'\n", $driver->client_version);
6256

6357
printf("driver->driver_version = '%s'\n", $driver->driver_version);
6458

@@ -102,20 +96,8 @@ Object variables:
10296
reconnect
10397
report_mode
10498

105-
Class constants:
106-
array(2) {
107-
["CLIENT_VERSION"]=>
108-
int(%d)
109-
["CLIENT_INFO"]=>
110-
string(%d) "%s"
111-
}
112-
11399
Magic, magic properties:
114-
115-
Deprecated: Property access to the client_info constant is deprecated in %s
116100
driver->client_info = '%s'
117-
118-
Deprecated: Property access to the client_version constant is deprecated in %s
119101
driver->client_version = '%d'
120102

121103
Deprecated: The driver_version property is deprecated in %s on line %d

ext/mysqli/tests/mysqli_class_mysqli_interface.phpt

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -152,27 +152,21 @@ require_once('skipifconnectfailure.inc');
152152
}
153153
echo "ok\n";
154154

155-
printf("\nClass constants:\n");
156-
$refl = new ReflectionClass($mysqli::class);
157-
var_dump($refl->getConstants());
158-
159155
printf("\nMagic, magic properties:\n");
160156

161157
assert(mysqli_affected_rows($link) === $mysqli->affected_rows);
162158
printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n",
163159
$mysqli->affected_rows, gettype($mysqli->affected_rows),
164160
mysqli_affected_rows($link), gettype(mysqli_affected_rows($link)));
165161

166-
$client_info = $mysqli->client_info;
167-
assert(mysqli_get_client_info() === $client_info);
162+
assert(mysqli_get_client_info() === $mysqli->client_info);
168163
printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n",
169-
$client_info, gettype($client_info),
164+
$mysqli->client_info, gettype($mysqli->client_info),
170165
mysqli_get_client_info(), gettype(mysqli_get_client_info()));
171166

172-
$client_version = $mysqli->client_version;
173-
assert(mysqli_get_client_version() === $client_version);
167+
assert(mysqli_get_client_version() === $mysqli->client_version);
174168
printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n",
175-
$client_version, gettype($client_version),
169+
$mysqli->client_version, gettype($mysqli->client_version),
176170
mysqli_get_client_version(), gettype(mysqli_get_client_version()));
177171

178172
assert(mysqli_errno($link) === $mysqli->errno);
@@ -277,21 +271,9 @@ ok
277271
Object variables:
278272
ok
279273

280-
Class constants:
281-
array(2) {
282-
["CLIENT_VERSION"]=>
283-
int(%d)
284-
["CLIENT_INFO"]=>
285-
string(%d) "%s"
286-
}
287-
288274
Magic, magic properties:
289275
mysqli->affected_rows = '%s'/integer ('%s'/integer)
290-
291-
Deprecated: Property access to the client_info constant is deprecated in %s
292276
mysqli->client_info = '%s'/string ('%s'/string)
293-
294-
Deprecated: Property access to the client_version constant is deprecated in %s
295277
mysqli->client_version = '%d'/integer ('%d'/integer)
296278
mysqli->errno = '0'/integer ('0'/integer)
297279
mysqli->error = ''/string (''/string)

ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ require_once('skipifconnectfailure.inc');
3232
}
3333
}
3434

35-
printf("\nClass constants:\n");
36-
$refl = new ReflectionClass($mysqli::class);
37-
var_dump($refl->getConstants());
38-
3935
printf("\nMagic, magic properties:\n");
4036
try {
4137
mysqli_affected_rows($mysqli);
@@ -49,11 +45,9 @@ require_once('skipifconnectfailure.inc');
4945
echo $exception->getMessage() . "\n";
5046
}
5147

52-
$client_info = $mysqli->client_info;
53-
printf("mysqli->client_info = '%s'/%s\n", $client_info, gettype($client_info));
48+
printf("mysqli->client_info = '%s'/%s\n", $mysqli->client_info, gettype($mysqli->client_info));
5449

55-
$client_version = $mysqli->client_version;
56-
printf("mysqli->client_version = '%s'/%s\n", $client_version, gettype($client_version));
50+
printf("mysqli->client_version = '%s'/%s\n", $mysqli->client_version, gettype($mysqli->client_version));
5751

5852
try {
5953
mysqli_errno($mysqli);
@@ -268,22 +262,10 @@ mysqli object is already closed
268262

269263
Object variables:
270264

271-
Class constants:
272-
array(2) {
273-
["CLIENT_VERSION"]=>
274-
int(%d)
275-
["CLIENT_INFO"]=>
276-
string(%d) "%s"
277-
}
278-
279265
Magic, magic properties:
280266
mysqli object is already closed
281267
Property access is not allowed yet
282-
283-
Deprecated: Property access to the client_info constant is deprecated in %s
284268
mysqli->client_info = '%s'/string
285-
286-
Deprecated: Property access to the client_version constant is deprecated in %s
287269
mysqli->client_version = '%d'/integer
288270
mysqli object is already closed
289271
mysqli object is already closed
@@ -324,11 +306,7 @@ mysqli object is already closed
324306

325307
Class variables:
326308
Property access is not allowed yet
327-
328-
Deprecated: Property access to the client_info constant is deprecated in %s
329309
client_info = '%s'
330-
331-
Deprecated: Property access to the client_version constant is deprecated in %s
332310
client_version = '%s'
333311
connect_errno = '%s'
334312
connect_error = '%s'
@@ -348,22 +326,10 @@ mysqli object is already closed
348326

349327
Object variables:
350328

351-
Class constants:
352-
array(2) {
353-
["CLIENT_VERSION"]=>
354-
int(%d)
355-
["CLIENT_INFO"]=>
356-
string(%d) "%s"
357-
}
358-
359329
Magic, magic properties:
360330
mysqli object is already closed
361331
Property access is not allowed yet
362-
363-
Deprecated: Property access to the client_info constant is deprecated in %s
364332
mysqli->client_info = '%s'/string
365-
366-
Deprecated: Property access to the client_version constant is deprecated in %s
367333
mysqli->client_version = '%d'/integer
368334
mysqli object is already closed
369335
mysqli object is already closed

ext/mysqli/tests/mysqli_driver.phpt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,13 @@ if (($tmp = $driver->client_info) !== $client_info) {
2020
gettype($tmp), $tmp);
2121
}
2222

23-
assert(mysqli_driver::CLIENT_INFO === mysqli_get_client_info());
24-
2523
$client_version = mysqli_get_client_version();
2624
if (($tmp = $driver->client_version) !== $client_version) {
2725
printf("[003] Expecting %s/%s, got %s/%s\n",
2826
gettype($client_version), $client_version,
2927
gettype($tmp), $tmp);
3028
}
3129

32-
assert(mysqli_driver::CLIENT_VERSION === mysqli_get_client_version());
33-
3430
$all_modes = [
3531
MYSQLI_REPORT_ALL,
3632
MYSQLI_REPORT_STRICT,
@@ -125,10 +121,5 @@ $driver->reconnect = $reconnect;
125121
print "done!";
126122
?>
127123
--EXPECTF--
128-
129-
Deprecated: Property access to the client_info constant is deprecated in %s
130-
131-
Deprecated: Property access to the client_version constant is deprecated in %s
132-
133124
Warning: mysqli_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'NO_SQL' at line 1 in %s on line %d
134125
done!

ext/mysqli/tests/mysqli_kill.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ bool(false)
8585
object(mysqli)#%d (%d) {
8686
["affected_rows"]=>
8787
int(-1)
88+
["client_info"]=>
89+
string(%d) "%s"
90+
["client_version"]=>
91+
int(%d)
8892
["connect_errno"]=>
8993
int(0)
9094
["connect_error"]=>

ext/mysqli/tests/mysqli_real_connect.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ mysqli.allow_local_infile=1
154154
--EXPECTF--
155155
Warning: mysqli_real_connect(): (%s/%d): Access denied for user '%s'@'%s' (using password: YES) in %s on line %d
156156
object(mysqli)#%d (%d) {
157+
["client_info"]=>
158+
string(%d) "%s"
159+
["client_version"]=>
160+
int(%d)
157161
["connect_errno"]=>
158162
int(%d)
159163
["connect_error"]=>

0 commit comments

Comments
 (0)