xref: /PHP-8.1/ext/odbc/tests/bug80147.phpt (revision b5a14e6c)
1--TEST--
2Bug #80147 (BINARY strings may not be properly zero-terminated)
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
13odbc_exec($conn, "CREATE TABLE bug80147 (id INT, whatever VARBINARY(50))");
14odbc_exec($conn, "INSERT INTO bug80147 VALUES (1, CONVERT(VARBINARY(50), 'whatever'))");
15
16$res = odbc_exec($conn, "SELECT * FROM bug80147");
17odbc_binmode($res, ODBC_BINMODE_RETURN);
18odbc_fetch_row($res);
19var_dump(odbc_result($res, 'whatever'));
20?>
21--CLEAN--
22<?php
23include 'config.inc';
24
25$conn = odbc_connect($dsn, $user, $pass);
26odbc_exec($conn, "DROP TABLE bug80147");
27?>
28--EXPECT--
29string(8) "whatever"
30