summaryrefslogtreecommitdiff
path: root/ext/mysqli/tests/bug79084_collision.phpt
blob: 9f0c72962d55df9801451ea50b0b8457295c3709 (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
--TEST--
Bug #79084 (mysqlnd may fetch wrong column indexes with MYSQLI_BOTH) - collision
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once('connect.inc');
$sql = "SELECT 11111 as `1`, 22222 as `2`";

// 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(3) {
  [0]=>
  string(5) "11111"
  [1]=>
  string(5) "11111"
  [2]=>
  string(5) "22222"
}
array(3) {
  [0]=>
  string(5) "11111"
  [1]=>
  string(5) "11111"
  [2]=>
  string(5) "22222"
}
array(3) {
  [0]=>
  string(5) "11111"
  [1]=>
  string(5) "11111"
  [2]=>
  string(5) "22222"
}