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