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