2 References to result sets
5 require_once('skipif.inc');
6 require_once('skipifemb.inc');
7 require_once('skipifconnectfailure.inc');
11 require_once('connect.inc');
12 require_once('table.inc');
14 $references = array();
16 if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
17 !($res = mysqli_store_result($link)))
18 printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
21 while ($row = mysqli_fetch_assoc($res)) {
22 /* mysqlnd: force seperation - create copies */
23 $references[$idx] = array(
25 'label' => $row['label'] . '');
26 $references[$idx++]['id'] += 0;
31 mysqli_data_seek($res, 0);
32 while ($row = mysqli_fetch_assoc($res)) {
33 /* mysqlnd: force seperation - create copies */
34 $references[$idx] = array(
36 'label' => $row['label'] . '');
37 $references[$idx++]['id'] += 0;
40 mysqli_free_result($res);
42 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
43 printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
44 $host, $user, $db, $port, $socket);
46 if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
47 !($res = mysqli_use_result($link)))
48 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
50 while ($row = mysqli_fetch_assoc($res)) {
51 /* mysqlnd: force seperation - create copies*/
52 $references[$idx] = array(
54 'label' => $row['label'] . '');
55 $references[$idx]['id2'] = &$references[$idx]['id'];
56 $references[$idx]['id'] += 1;
57 $references[$idx++]['id2'] += 1;
60 $references[$idx++] = &$res;
61 mysqli_free_result($res);
62 @debug_zval_dump($references);
64 if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) ||
65 !($res = mysqli_use_result($link)))
66 printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
69 while ($row = mysqli_fetch_assoc($res)) {
72 $tmp = unserialize(serialize($tmp));
73 debug_zval_dump($tmp);
74 mysqli_free_result($res);
81 require_once("clean_table.inc");
90 %unicode|string%(1) "a" refcount(1)
97 %unicode|string%(1) "b" refcount(1)
100 array(2) refcount(1){
104 %unicode|string%(1) "a" refcount(1)
107 array(2) refcount(1){
111 %unicode|string%(1) "b" refcount(1)
114 array(3) refcount(1){
118 %unicode|string%(1) "a" refcount(1)
123 array(3) refcount(1){
127 %unicode|string%(1) "b" refcount(1)
132 &object(mysqli_result)#2 (5) refcount(2){
133 [%u|b%"current_field"]=>
135 [%u|b%"field_count"]=>
145 array(1) refcount(2){
147 array(2) refcount(1){
149 %unicode|string%(1) "1" refcount(1)
151 %unicode|string%(1) "a" refcount(1)