blob: 8e2dcf2aca1ed20ec896f2bdc6465e50ee36d0fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
--TEST--
References to result sets - mysqlnd (no copies but references)
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('skipifconnectfailure.inc');
require_once('connect.inc');
if (!$IS_MYSQLND)
die("skip Test for mysqlnd only");
?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
require_once('connect.inc');
require_once('table.inc');
$references = array();
if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) ||
!($res = mysqli_store_result($link)))
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$idx = 0;
while ($row = mysqli_fetch_assoc($res)) {
/* will overwrite itself */
$references[$idx]['row_ref'] = &$row;
$references[$idx]['row_copy'] = $row;
$references[$idx]['id_ref'] = &$row['id'];
$references[$idx++]['id_copy'] = $row['id'];
}
mysqli_free_result($res);
if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2")) ||
!($res = mysqli_use_result($link)))
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$rows = array();
for ($i = 0; $i < 2; $i++) {
$rows[$i] = mysqli_fetch_assoc($res);
$references[$idx]['row_ref'] = &$rows[$i];
$references[$idx]['row_copy'] = $rows[$i];
$references[$idx]['id_ref'] = &$rows[$i]['id'];
$references[$idx]['id_copy'] = $rows[$i]['id'];
/* enforce seperation */
$references[$idx]['id_copy_mod']= $rows[$i]['id'] + 0;
}
mysqli_free_result($res);
debug_zval_dump($references);
print "done!";
?>
--EXPECTF--
array(2) refcount(2){
[0]=>
array(4) refcount(1){
["row_ref"]=>
&NULL refcount(2)
["row_copy"]=>
array(2) refcount(1){
["id"]=>
string(1) "1" refcount(2)
["label"]=>
string(1) "a" refcount(2)
}
["id_ref"]=>
string(1) "1" refcount(1)
["id_copy"]=>
string(1) "1" refcount(1)
}
[1]=>
array(5) refcount(1){
["row_ref"]=>
&array(2) refcount(2){
["id"]=>
&string(1) "2" refcount(2)
["label"]=>
string(1) "b" refcount(3)
}
["row_copy"]=>
array(2) refcount(1){
["id"]=>
string(1) "2" refcount(2)
["label"]=>
string(1) "b" refcount(3)
}
["id_ref"]=>
&string(1) "2" refcount(2)
["id_copy"]=>
string(1) "2" refcount(1)
["id_copy_mod"]=>
long(2) refcount(1)
}
}
done!
--UEXPECTF--
array(2) refcount(2){
[0]=>
array(4) refcount(1){
[u"row_ref" { 0072 006f 0077 005f 0072 0065 0066 }]=>
&NULL refcount(2)
[u"row_copy" { 0072 006f 0077 005f 0063 006f 0070 0079 }]=>
array(2) refcount(1){
[u"id" { 0069 0064 }]=>
unicode(1) "1" { 0031 } refcount(2)
[u"label" { 006c 0061 0062 0065 006c }]=>
unicode(1) "a" { 0061 } refcount(2)
}
[u"id_ref" { 0069 0064 005f 0072 0065 0066 }]=>
unicode(1) "1" { 0031 } refcount(1)
[u"id_copy" { 0069 0064 005f 0063 006f 0070 0079 }]=>
unicode(1) "1" { 0031 } refcount(1)
}
[1]=>
array(5) refcount(1){
[u"row_ref" { 0072 006f 0077 005f 0072 0065 0066 }]=>
&array(2) refcount(2){
[u"id" { 0069 0064 }]=>
&unicode(1) "2" { 0032 } refcount(2)
[u"label" { 006c 0061 0062 0065 006c }]=>
unicode(1) "b" { 0062 } refcount(3)
}
[u"row_copy" { 0072 006f 0077 005f 0063 006f 0070 0079 }]=>
array(2) refcount(1){
[u"id" { 0069 0064 }]=>
unicode(1) "2" { 0032 } refcount(2)
[u"label" { 006c 0061 0062 0065 006c }]=>
unicode(1) "b" { 0062 } refcount(3)
}
[u"id_ref" { 0069 0064 005f 0072 0065 0066 }]=>
&unicode(1) "2" { 0032 } refcount(2)
[u"id_copy" { 0069 0064 005f 0063 006f 0070 0079 }]=>
unicode(1) "2" { 0032 } refcount(1)
[u"id_copy_mod" { 0069 0064 005f 0063 006f 0070 0079 005f 006d 006f 0064 }]=>
long(2) refcount(1)
}
}
done!
|