xref: /PHP-8.0/ext/odbc/tests/bug69975.phpt (revision 82637e81)
1--TEST--
2Bug #69975 (PHP segfaults when accessing nvarchar(max) defined columns)
3--SKIPIF--
4<?php include 'skipif.inc'; ?>
5--FILE--
6<?php
7include 'config.inc';
8
9$conn = odbc_connect($dsn, $user, $pass);
10@odbc_exec($conn, 'CREATE DATABASE odbcTEST');
11odbc_exec($conn, 'CREATE TABLE FOO (ID INT, VARCHAR_COL NVARCHAR(MAX))');
12odbc_exec($conn, "INSERT INTO FOO VALUES (1, 'foo')");
13
14$result = odbc_exec($conn, "SELECT VARCHAR_COL FROM FOO");
15var_dump(odbc_fetch_array($result));
16
17echo "ready";
18?>
19--EXPECT--
20array(1) {
21  ["VARCHAR_COL"]=>
22  string(3) "foo"
23}
24ready
25--CLEAN--
26<?php
27include 'config.inc';
28
29$conn = odbc_connect($dsn, $user, $pass);
30odbc_exec($conn, 'DROP TABLE FOO');
31odbc_exec($conn, 'DROP DATABASE odbcTEST');
32?>
33