summaryrefslogtreecommitdiff
path: root/ext/mysqli/tests/bug79084.phpt
blob: b760c4abb76592636e11d613bf217de0aacf927c (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
--TEST--
Bug #79084 (mysqlnd may fetch wrong column indexes with MYSQLI_BOTH)
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once('connect.inc');
$sql = "SELECT 0 as `2007`, 0 as `2008`, 0 as `2020`";

// unbuffered
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$link->real_query($sql);
$res = $link->use_result();
$row = $res->fetch_array();
var_dump($row);
$link->close();

// buffered
ini_set('mysqlnd.fetch_data_copy', false);
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$res = $link->query($sql);
$row = $res->fetch_array();
var_dump($row);
$link->close();

// buffered copies
ini_set('mysqlnd.fetch_data_copy', true);
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$res = $link->query($sql);
$row = $res->fetch_array();
var_dump($row);
$link->close();
?>
--EXPECT--
array(6) {
  [0]=>
  string(1) "0"
  [2007]=>
  string(1) "0"
  [1]=>
  string(1) "0"
  [2008]=>
  string(1) "0"
  [2]=>
  string(1) "0"
  [2020]=>
  string(1) "0"
}
array(6) {
  [0]=>
  string(1) "0"
  [2007]=>
  string(1) "0"
  [1]=>
  string(1) "0"
  [2008]=>
  string(1) "0"
  [2]=>
  string(1) "0"
  [2020]=>
  string(1) "0"
}
array(6) {
  [0]=>
  string(1) "0"
  [2007]=>
  string(1) "0"
  [1]=>
  string(1) "0"
  [2008]=>
  string(1) "0"
  [2]=>
  string(1) "0"
  [2020]=>
  string(1) "0"
}