bug79084.phpt 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. --TEST--
  2. Bug #79084 (mysqlnd may fetch wrong column indexes with MYSQLI_BOTH)
  3. --EXTENSIONS--
  4. mysqli
  5. --SKIPIF--
  6. <?php
  7. require_once('skipifconnectfailure.inc');
  8. ?>
  9. --FILE--
  10. <?php
  11. require_once('connect.inc');
  12. $sql = "SELECT 0 as `2007`, 0 as `2008`, 0 as `2020`";
  13. // unbuffered
  14. $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
  15. $link->real_query($sql);
  16. $res = $link->use_result();
  17. $row = $res->fetch_array();
  18. var_dump($row);
  19. $link->close();
  20. // buffered
  21. ini_set('mysqlnd.fetch_data_copy', false);
  22. $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
  23. $res = $link->query($sql);
  24. $row = $res->fetch_array();
  25. var_dump($row);
  26. $link->close();
  27. // buffered copies
  28. ini_set('mysqlnd.fetch_data_copy', true);
  29. $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
  30. $res = $link->query($sql);
  31. $row = $res->fetch_array();
  32. var_dump($row);
  33. $link->close();
  34. ?>
  35. --EXPECT--
  36. array(6) {
  37. [0]=>
  38. string(1) "0"
  39. [2007]=>
  40. string(1) "0"
  41. [1]=>
  42. string(1) "0"
  43. [2008]=>
  44. string(1) "0"
  45. [2]=>
  46. string(1) "0"
  47. [2020]=>
  48. string(1) "0"
  49. }
  50. array(6) {
  51. [0]=>
  52. string(1) "0"
  53. [2007]=>
  54. string(1) "0"
  55. [1]=>
  56. string(1) "0"
  57. [2008]=>
  58. string(1) "0"
  59. [2]=>
  60. string(1) "0"
  61. [2020]=>
  62. string(1) "0"
  63. }
  64. array(6) {
  65. [0]=>
  66. string(1) "0"
  67. [2007]=>
  68. string(1) "0"
  69. [1]=>
  70. string(1) "0"
  71. [2008]=>
  72. string(1) "0"
  73. [2]=>
  74. string(1) "0"
  75. [2020]=>
  76. string(1) "0"
  77. }