1--TEST-- 2References to result sets 3--EXTENSIONS-- 4mysqli 5--SKIPIF-- 6<?php 7require_once('skipifconnectfailure.inc'); 8?> 9--INI-- 10opcache.enable=0 11--FILE-- 12<?php 13 require_once('connect.inc'); 14 require_once('table.inc'); 15 16 $references = array(); 17 18 if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) || 19 !($res = mysqli_store_result($link))) 20 printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 21 22 $idx = 0; 23 while ($row = mysqli_fetch_assoc($res)) { 24 /* mysqlnd: force separation - create copies */ 25 $references[$idx] = array( 26 'id' => &$row['id'], 27 'label' => $row['label'] . ''); 28 $references[$idx++]['id'] += 0; 29 } 30 31 mysqli_close($link); 32 33 mysqli_data_seek($res, 0); 34 while ($row = mysqli_fetch_assoc($res)) { 35 /* mysqlnd: force separation - create copies */ 36 $references[$idx] = array( 37 'id' => &$row['id'], 38 'label' => $row['label'] . ''); 39 $references[$idx++]['id'] += 0; 40 } 41 42 mysqli_free_result($res); 43 44 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) 45 printf("[002] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", 46 $host, $user, $db, $port, $socket); 47 48 if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) || 49 !($res = mysqli_use_result($link))) 50 printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 51 52 while ($row = mysqli_fetch_assoc($res)) { 53 /* mysqlnd: force separation - create copies*/ 54 $references[$idx] = array( 55 'id' => &$row['id'], 56 'label' => $row['label'] . ''); 57 $references[$idx]['id2'] = &$references[$idx]['id']; 58 $references[$idx]['id'] += 1; 59 $references[$idx++]['id2'] += 1; 60 } 61 62 $references[$idx++] = &$res; 63 mysqli_free_result($res); 64 65 debug_zval_dump($references); 66 67 if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) || 68 !($res = mysqli_use_result($link))) 69 printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); 70 71 $tmp = array(); 72 while ($row = mysqli_fetch_assoc($res)) { 73 $tmp[] = $row; 74 } 75 $tmp = unserialize(serialize($tmp)); 76 debug_zval_dump($tmp); 77 mysqli_free_result($res); 78 79 mysqli_close($link); 80 print "done!"; 81?> 82--CLEAN-- 83<?php 84 require_once("clean_table.inc"); 85?> 86--EXPECTF-- 87array(7) refcount(2){ 88 [0]=> 89 array(2) refcount(1){ 90 ["id"]=> 91 reference refcount(1) { 92 int(1) 93 } 94 ["label"]=> 95 string(1) "a" refcount(%d) 96 } 97 [1]=> 98 array(2) refcount(1){ 99 ["id"]=> 100 reference refcount(1) { 101 int(2) 102 } 103 ["label"]=> 104 string(1) "b" refcount(%d) 105 } 106 [2]=> 107 array(2) refcount(1){ 108 ["id"]=> 109 reference refcount(1) { 110 int(1) 111 } 112 ["label"]=> 113 string(1) "a" refcount(%d) 114 } 115 [3]=> 116 array(2) refcount(1){ 117 ["id"]=> 118 reference refcount(1) { 119 int(2) 120 } 121 ["label"]=> 122 string(1) "b" refcount(%d) 123 } 124 [4]=> 125 array(3) refcount(1){ 126 ["id"]=> 127 reference refcount(2) { 128 int(3) 129 } 130 ["label"]=> 131 string(1) "a" refcount(%d) 132 ["id2"]=> 133 reference refcount(2) { 134 int(3) 135 } 136 } 137 [5]=> 138 array(3) refcount(1){ 139 ["id"]=> 140 reference refcount(2) { 141 int(4) 142 } 143 ["label"]=> 144 string(1) "b" refcount(%d) 145 ["id2"]=> 146 reference refcount(2) { 147 int(4) 148 } 149 } 150 [6]=> 151 reference refcount(2) { 152 object(mysqli_result)#2 (0) refcount(1){ 153 } 154 } 155} 156array(1) refcount(2){ 157 [0]=> 158 array(2) refcount(1){ 159 ["id"]=> 160 string(1) "1" interned 161 ["label"]=> 162 string(1) "a" interned 163 } 164} 165done! 166