Annotation of embedaddon/php/ext/mysqli/tests/bug45019.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #45019 (Segmentation fault with SELECT ? and UNION)
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: require_once('skipifemb.inc');
! 7: require_once('skipifconnectfailure.inc');
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11: require_once("connect.inc");
! 12: require_once("table.inc");
! 13:
! 14: // Regular (non-prepared) queries
! 15: print "Using CAST('somestring' AS CHAR)...\n";
! 16: if (!($res = $link->query("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
! 17: printf("[001] [%d] %s\n", $link->errno, $link->error);
! 18:
! 19: $data = array();
! 20: while ($row = $res->fetch_assoc()) {
! 21: $data[] = $row['column1'];
! 22: var_dump($row['column1']);
! 23: }
! 24: $res->free();
! 25:
! 26: // Prepared Statements
! 27: if (!($stmt = $link->prepare("SELECT CAST('one' AS CHAR) AS column1 UNION SELECT CAST('three' AS CHAR) UNION SELECT CAST('two' AS CHAR)")))
! 28: printf("[002] [%d] %s\n", $link->errno, $link->error);
! 29:
! 30: $column1 = null;
! 31: if (!$stmt->bind_result($column1) || !$stmt->execute())
! 32: printf("[003] [%d] %s\n", $stmt->errno, $stmt->error);
! 33:
! 34: $index = 0;
! 35: while ($stmt->fetch()) {
! 36: /* NOTE: libmysql - http://bugs.mysql.com/bug.php?id=47483 */
! 37: if ($data[$index] != $column1) {
! 38: if ($IS_MYSQLND || $index != 1) {
! 39: printf("[004] Row %d, expecting %s/%s got %s/%s\n",
! 40: $index + 1, gettype($data[$index]), $data[$index], gettype($column1), $column1);
! 41: } else {
! 42: if ($column1 != "thre")
! 43: printf("[005] Got '%s'. Please check if http://bugs.mysql.com/bug.php?id=47483 has been fixed and adapt tests bug45019.phpt/mysqli_ps_select_union.phpt", $column1);
! 44: }
! 45: }
! 46: $index++;
! 47: }
! 48: $stmt->close();
! 49:
! 50: $link->close();
! 51:
! 52: print "done!";
! 53: ?>
! 54: --EXPECTF--
! 55: Using CAST('somestring' AS CHAR)...
! 56: %unicode|string%(3) "one"
! 57: %unicode|string%(5) "three"
! 58: %unicode|string%(3) "two"
! 59: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>