1--TEST--
2Interface of the class mysqli
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10    require('table.inc');
11
12    function dump_properties($mysqli) {
13
14        printf("\nClass variables:\n");
15        $variables = array_keys(get_class_vars(get_class($mysqli)));
16        sort($variables);
17        foreach ($variables as $k => $var) {
18            try {
19                printf("%s = '%s'\n", $var, var_export($mysqli->$var, true));
20            } catch (Error $exception) {
21                echo $exception->getMessage() . "\n";
22            }
23        }
24
25        printf("\nObject variables:\n");
26        $variables = array_keys(get_object_vars($mysqli));
27        foreach ($variables as $k => $var) {
28            try {
29                printf("%s = '%s'\n", $var, var_export($mysqli->$var, true));
30            } catch (Error $exception) {
31                echo $exception->getMessage() . "\n";
32            }
33        }
34
35        printf("\nMagic, magic properties:\n");
36        try {
37            mysqli_affected_rows($mysqli);
38        } catch (Error $exception) {
39            echo $exception->getMessage() . "\n";
40        }
41
42        try {
43            $mysqli->affected_rows;
44        } catch (Error $exception) {
45            echo $exception->getMessage() . "\n";
46        }
47
48        try {
49            $mysqli->client_info;
50        } catch (Error $exception) {
51            echo $exception->getMessage() . "\n";
52        }
53
54        printf("mysqli->client_version = '%s'/%s\n", $mysqli->client_version, gettype($mysqli->client_version));
55
56        try {
57            mysqli_errno($mysqli);
58        } catch (Error $exception) {
59            echo $exception->getMessage() . "\n";
60        }
61
62        try {
63            $mysqli->errno;
64        } catch (Error $exception) {
65            echo $exception->getMessage() . "\n";
66        }
67
68        try {
69            mysqli_error($mysqli);
70        } catch (Error $exception) {
71            echo $exception->getMessage() . "\n";
72        }
73
74        try {
75            $mysqli->error;
76        } catch (Error $exception) {
77            echo $exception->getMessage() . "\n";
78        }
79
80        try {
81            mysqli_field_count($mysqli);
82        } catch (Error $exception) {
83            echo $exception->getMessage() . "\n";
84        }
85
86        try {
87            $mysqli->field_count;
88        } catch (Error $exception) {
89            echo $exception->getMessage() . "\n";
90        }
91
92        try {
93            mysqli_insert_id($mysqli);
94        } catch (Error $exception) {
95            echo $exception->getMessage() . "\n";
96        }
97
98        try {
99            $mysqli->insert_id;
100        } catch (Error $exception) {
101            echo $exception->getMessage() . "\n";
102        }
103
104        try {
105            mysqli_sqlstate($mysqli);
106        } catch (Error $exception) {
107            echo $exception->getMessage() . "\n";
108        }
109
110        try {
111            $mysqli->sqlstate;
112        } catch (Error $exception) {
113            echo $exception->getMessage() . "\n";
114        }
115
116        try {
117            mysqli_get_host_info($mysqli);
118        } catch (Error $exception) {
119            echo $exception->getMessage() . "\n";
120        }
121
122        try {
123            $mysqli->host_info;
124        } catch (Error $exception) {
125            echo $exception->getMessage() . "\n";
126        }
127
128        try {
129            mysqli_info($mysqli);
130        } catch (Error $exception) {
131            echo $exception->getMessage() . "\n";
132        }
133
134        try {
135            $mysqli->info;
136        } catch (Error $exception) {
137            echo $exception->getMessage() . "\n";
138        }
139
140        try {
141            mysqli_thread_id($mysqli);
142        } catch (Error $exception) {
143            echo $exception->getMessage() . "\n";
144        }
145
146        try {
147            $mysqli->thread_id;
148        } catch (Error $exception) {
149            echo $exception->getMessage() . "\n";
150        }
151
152        try {
153            mysqli_get_proto_info($mysqli);
154        } catch (Error $exception) {
155            echo $exception->getMessage() . "\n";
156        }
157
158        try {
159            $mysqli->protocol_version;
160        } catch (Error $exception) {
161            echo $exception->getMessage() . "\n";
162        }
163
164        try {
165            mysqli_get_server_info($mysqli);
166        } catch (Error $exception) {
167            echo $exception->getMessage() . "\n";
168        }
169
170        try {
171            $mysqli->server_info;
172        } catch (Error $exception) {
173            echo $exception->getMessage() . "\n";
174        }
175
176        try {
177            mysqli_get_server_version($mysqli);
178        } catch (Error $exception) {
179            echo $exception->getMessage() . "\n";
180        }
181
182        try {
183            $mysqli->server_version;
184        } catch (Error $exception) {
185            echo $exception->getMessage() . "\n";
186        }
187
188        try {
189            mysqli_warning_count($mysqli);
190        } catch (Error $exception) {
191            echo $exception->getMessage() . "\n";
192        }
193
194        try {
195            $mysqli->warning_count;
196        } catch (Error $exception) {
197            echo $exception->getMessage() . "\n";
198        }
199
200
201        printf("\nAccess to undefined properties:\n");
202        printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
203
204        @$mysqli->unknown = 13;
205        printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
206
207        $unknown = 'friday';
208        @$mysqli->unknown = $unknown;
209        printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
210
211        printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
212        assert(@mysqli_connect_error() === @$mysqli->connect_error);
213        printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n",
214            @$mysqli->connect_error, gettype(@$mysqli->connect_error),
215            @mysqli_connect_error(), gettype(@mysqli_connect_error()));
216
217        assert(@mysqli_connect_errno() === @$mysqli->connect_errno);
218        printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n",
219            @$mysqli->connect_errno, gettype(@$mysqli->connect_errno),
220            @mysqli_connect_errno(), gettype(@mysqli_connect_errno()));
221    }
222
223    printf("Without RS\n");
224    $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket);
225    dump_properties($mysqli);
226
227    printf("\nWith RS\n");
228    $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket);
229    try {
230        $mysqli->query("SELECT * FROM test");
231    } catch (Error $exception) {
232        echo $exception->getMessage() . "\n";
233    }
234    dump_properties($mysqli);
235
236    print "done!";
237?>
238--CLEAN--
239<?php require_once("clean_table.inc"); ?>
240--EXPECTF--
241Without RS
242
243Class variables:
244Property access is not allowed yet
245Property access is not allowed yet
246client_version = '%s'
247connect_errno = '%s'
248connect_error = ''%s'
249mysqli object is already closed
250mysqli object is already closed
251Property access is not allowed yet
252mysqli object is already closed
253mysqli object is already closed
254mysqli object is already closed
255mysqli object is already closed
256mysqli object is already closed
257mysqli object is already closed
258mysqli object is already closed
259mysqli object is already closed
260mysqli object is already closed
261mysqli object is already closed
262
263Object variables:
264Property access is not allowed yet
265Property access is not allowed yet
266client_version = '%s'
267connect_errno = '%s'
268connect_error = ''%s'
269mysqli object is already closed
270mysqli object is already closed
271Property access is not allowed yet
272mysqli object is already closed
273mysqli object is already closed
274mysqli object is already closed
275mysqli object is already closed
276mysqli object is already closed
277mysqli object is already closed
278mysqli object is already closed
279mysqli object is already closed
280mysqli object is already closed
281mysqli object is already closed
282
283Magic, magic properties:
284mysqli object is already closed
285Property access is not allowed yet
286Property access is not allowed yet
287mysqli->client_version = '%d'/integer
288mysqli object is already closed
289mysqli object is already closed
290mysqli object is already closed
291mysqli object is already closed
292mysqli object is already closed
293mysqli object is already closed
294mysqli object is already closed
295mysqli object is already closed
296mysqli object is already closed
297mysqli object is already closed
298mysqli object is already closed
299mysqli object is already closed
300mysqli object is already closed
301mysqli object is already closed
302mysqli object is already closed
303mysqli object is already closed
304mysqli object is already closed
305mysqli object is already closed
306mysqli object is already closed
307mysqli object is already closed
308mysqli object is already closed
309mysqli object is already closed
310mysqli object is already closed
311mysqli object is already closed
312
313Access to undefined properties:
314mysqli->unknown = ''
315setting mysqli->unknown, @mysqli_unknown = '13'
316setting mysqli->unknown, @mysqli_unknown = 'friday'
317
318Access hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):
319mysqli->connect_error = '%s'/%s)
320mysqli->connect_errno = '%s'/integer ('%s'/integer)
321
322With RS
323mysqli object is already closed
324
325Class variables:
326Property access is not allowed yet
327Property access is not allowed yet
328client_version = '%s'
329connect_errno = '%s'
330connect_error = '%s'
331mysqli object is already closed
332mysqli object is already closed
333Property access is not allowed yet
334mysqli object is already closed
335mysqli object is already closed
336mysqli object is already closed
337mysqli object is already closed
338mysqli object is already closed
339mysqli object is already closed
340mysqli object is already closed
341mysqli object is already closed
342mysqli object is already closed
343mysqli object is already closed
344
345Object variables:
346Property access is not allowed yet
347Property access is not allowed yet
348client_version = '%s'
349connect_errno = '%s'
350connect_error = '%s'
351mysqli object is already closed
352mysqli object is already closed
353Property access is not allowed yet
354mysqli object is already closed
355mysqli object is already closed
356mysqli object is already closed
357mysqli object is already closed
358mysqli object is already closed
359mysqli object is already closed
360mysqli object is already closed
361mysqli object is already closed
362mysqli object is already closed
363mysqli object is already closed
364
365Magic, magic properties:
366mysqli object is already closed
367Property access is not allowed yet
368Property access is not allowed yet
369mysqli->client_version = '%d'/integer
370mysqli object is already closed
371mysqli object is already closed
372mysqli object is already closed
373mysqli object is already closed
374mysqli object is already closed
375mysqli object is already closed
376mysqli object is already closed
377mysqli object is already closed
378mysqli object is already closed
379mysqli object is already closed
380mysqli object is already closed
381mysqli object is already closed
382mysqli object is already closed
383mysqli object is already closed
384mysqli object is already closed
385mysqli object is already closed
386mysqli object is already closed
387mysqli object is already closed
388mysqli object is already closed
389mysqli object is already closed
390mysqli object is already closed
391mysqli object is already closed
392mysqli object is already closed
393mysqli object is already closed
394
395Access to undefined properties:
396mysqli->unknown = ''
397setting mysqli->unknown, @mysqli_unknown = '13'
398setting mysqli->unknown, @mysqli_unknown = 'friday'
399
400Access hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):
401mysqli->connect_error = '%s'/%s)
402mysqli->connect_errno = '%s'/integer ('%s'/integer)
403done!
404