xref: /PHP-8.1/ext/pdo_dblib/tests/bug_73396.phpt (revision 74859783)
1--TEST--
2PDO_DBLIB: bigint columns are returned as strings
3--EXTENSIONS--
4pdo_dblib
5--SKIPIF--
6<?php
7require __DIR__ . '/config.inc';
8if (in_array($db->getAttribute(PDO::DBLIB_ATTR_TDS_VERSION), ['4.2', '4.6', '5.0', '6.0', '7.0'])) die('skip bigint type is unsupported by active TDS version');
9?>
10--FILE--
11<?php
12require __DIR__ . '/config.inc';
13
14// on 64-bit machines, these columns should come back as ints
15// on 32-bit machines, they will come back as strings because zend_long isn't big enough
16$expected = PHP_INT_SIZE == 8 ? 1 : '1';
17
18$stmt = $db->query('SELECT CAST(1 AS bigint)');
19var_dump($stmt->fetchColumn() === $expected);
20?>
21--EXPECT--
22bool(true)
23