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