@@ -56,6 +56,11 @@ require_once('skipifconnectfailure.inc');
56
56
'thread_safe ' => true ,
57
57
'use_result ' => true ,
58
58
);
59
+
60
+ if (version_compare (PHP_VERSION , '5.3.99 ' , '<= ' )) {
61
+ $ expected_methods ['client_encoding ' ] = true ;
62
+ }
63
+
59
64
if ($ IS_MYSQLND ) {
60
65
// mysqlnd only
61
66
/* $expected_methods['get_client_stats'] = true; */
@@ -94,15 +99,70 @@ require_once('skipifconnectfailure.inc');
94
99
printf ("ok \n" );
95
100
96
101
printf ("\nClass variables: \n" );
97
- $ variables = array_keys (get_class_vars (get_class ($ mysqli )));
98
- sort ($ variables );
99
- foreach ($ variables as $ k => $ var )
100
- printf ("%s \n" , $ var );
102
+
103
+ $ expected_class_variables = $ expected_object_variables = array (
104
+ "affected_rows " => true ,
105
+ "client_info " => true ,
106
+ "client_version " => true ,
107
+ "connect_errno " => true ,
108
+ "connect_error " => true ,
109
+ "errno " => true ,
110
+ "error " => true ,
111
+ "field_count " => true ,
112
+ "host_info " => true ,
113
+ "info " => true ,
114
+ "insert_id " => true ,
115
+ "protocol_version " => true ,
116
+ "server_info " => true ,
117
+ "server_version " => true ,
118
+ "sqlstate " => true ,
119
+ "stat " => true ,
120
+ "thread_id " => true ,
121
+ "warning_count " => true ,
122
+ );
123
+
124
+ if (version_compare (PHP_VERSION , '5.3.99 ' , '> ' )) {
125
+ $ expected_class_variables ["error_list " ] = true ;
126
+ $ expected_object_variables ["error_list " ] = true ;
127
+ }
128
+
129
+ $ variables = get_class_vars (get_class ($ mysqli ));
130
+ foreach ($ variables as $ var => $ v ) {
131
+ if (isset ($ expected_class_variables [$ var ])) {
132
+ unset($ expected_class_variables [$ var ]);
133
+ unset($ variables [$ var ]);
134
+ }
135
+ }
136
+
137
+ if (!empty ($ expected_class_variables )) {
138
+ printf ("Dumping list of missing class variables \n" );
139
+ var_dump ($ expected_class_variables );
140
+ }
141
+ if (!empty ($ variables )) {
142
+ printf ("Dumping list of unexpected class variables \n" );
143
+ var_dump ($ variables );
144
+ }
145
+ echo "ok \n" ;
101
146
102
147
printf ("\nObject variables: \n" );
103
- $ variables = array_keys (get_object_vars ($ mysqli ));
104
- foreach ($ variables as $ k => $ var )
105
- printf ("%s \n" , $ var );
148
+ $ variables = get_object_vars ($ mysqli );
149
+ foreach ($ variables as $ var => $ v ) {
150
+ if (isset ($ expected_object_variables [$ var ])) {
151
+ unset($ expected_object_variables [$ var ]);
152
+ unset($ variables [$ var ]);
153
+ }
154
+ }
155
+
156
+ if (!empty ($ expected_object_variables )) {
157
+ printf ("Dumping list of missing object variables \n" );
158
+ var_dump ($ expected_object_variables );
159
+ }
160
+ if (!empty ($ variables )) {
161
+ printf ("Dumping list of unexpected object variables \n" );
162
+ var_dump ($ variables );
163
+ }
164
+ echo "ok \n" ;
165
+
106
166
107
167
printf ("\nMagic, magic properties: \n" );
108
168
@@ -131,10 +191,10 @@ require_once('skipifconnectfailure.inc');
131
191
$ mysqli ->error , gettype ($ mysqli ->error ),
132
192
mysqli_error ($ link ), gettype (mysqli_error ($ link )));
133
193
134
- assert ( mysqli_error_list ( $ link ) === $ mysqli -> error_list );
135
- printf ( " mysqli->error_list = '%s'/%s ('%s'/%s) \n" ,
136
- $ mysqli -> error_list , gettype ( $ mysqli ->error_list ),
137
- mysqli_error_list ( $ link ), gettype ( mysqli_error_list ( $ link )));
194
+ if ( version_compare ( PHP_VERSION , ' 5.3.99 ' , ' > ' )) {
195
+ assert ( mysqli_error_list ( $ link ) === $ mysqli ->error_list );
196
+ assert ( is_array ( $ mysqli ->error_list ));
197
+ }
138
198
139
199
assert (mysqli_field_count ($ link ) === $ mysqli ->field_count );
140
200
printf ("mysqli->field_count = '%s'/%s ('%s'/%s) \n" ,
@@ -225,54 +285,17 @@ Methods:
225
285
ok
226
286
227
287
Class variables:
228
- affected_rows
229
- client_info
230
- client_version
231
- connect_errno
232
- connect_error
233
- errno
234
- error
235
- error_list
236
- field_count
237
- host_info
238
- info
239
- insert_id
240
- protocol_version
241
- server_info
242
- server_version
243
- sqlstate
244
- stat
245
- thread_id
246
- warning_count
288
+ ok
247
289
248
290
Object variables:
249
- affected_rows
250
- client_info
251
- client_version
252
- connect_errno
253
- connect_error
254
- errno
255
- error
256
- error_list
257
- field_count
258
- host_info
259
- info
260
- insert_id
261
- server_info
262
- server_version
263
- stat
264
- sqlstate
265
- protocol_version
266
- thread_id
267
- warning_count
291
+ ok
268
292
269
293
Magic, magic properties:
270
294
mysqli->affected_rows = '%s'/integer ('%s'/integer)
271
295
mysqli->client_info = '%s'/%unicode|string% ('%s'/%unicode|string%)
272
296
mysqli->client_version = '%d'/integer ('%d'/integer)
273
297
mysqli->errno = '0'/integer ('0'/integer)
274
298
mysqli->error = ''/%unicode|string% (''/%unicode|string%)
275
- mysqli->error_list = 'Array'/array ('Array'/array)
276
299
mysqli->field_count = '0'/integer ('0'/integer)
277
300
mysqli->insert_id = '0'/integer ('0'/integer)
278
301
mysqli->sqlstate = '00000'/%unicode|string% ('00000'/%unicode|string%)
0 commit comments