xref: /PHP-8.0/ext/odbc/tests/bug71171.phpt (revision f8d79582)
1--TEST--
2Bug #71171 odbc_fetch_array generates SIGFAULT, variant 0
3--SKIPIF--
4<?php include 'skipif.inc'; ?>
5--FILE--
6<?php
7
8include 'config.inc';
9
10$conn = odbc_connect($dsn, $user, $pass);
11
12@odbc_exec($conn, 'CREATE DATABASE odbcTEST');
13
14odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL NVARCHAR(40))');
15
16odbc_exec($conn, "INSERT INTO FOO(ID, VARCHAR_COL) VALUES (1, '" . chr(0x81) . "')");
17
18$res = odbc_exec($conn,"SELECT ID FROM FOO WHERE VARCHAR_COL = '" . chr(0x81) . "'");
19if ($res) {
20    while($record = odbc_fetch_array($res)) var_dump($record);
21}
22
23odbc_close($conn);
24?>
25--EXPECT--
26array(1) {
27  ["ID"]=>
28  string(1) "1"
29}
30--CLEAN--
31<?php
32include 'config.inc';
33
34$conn = odbc_connect($dsn, $user, $pass);
35
36odbc_exec($conn, 'DROP TABLE FOO');
37odbc_exec($conn, 'DROP DATABASE odbcTEST');
38
39odbc_close($conn);
40
41?>
42