xref: /PHP-8.4/ext/pdo_dblib/tests/bug_73396.phpt (revision d6a0b3af)
1--TEST--
2PDO_DBLIB: bigint columns are returned as strings
3--EXTENSIONS--
4pdo_dblib
5--SKIPIF--
6<?php
7require __DIR__ . '/config.inc';
8$db = getDbConnection();
9if (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');
10?>
11--FILE--
12<?php
13require __DIR__ . '/config.inc';
14
15$db = getDbConnection();
16
17// on 64-bit machines, these columns should come back as ints
18// on 32-bit machines, they will come back as strings because zend_long isn't big enough
19$expected = PHP_INT_SIZE == 8 ? 1 : '1';
20
21$stmt = $db->query('SELECT CAST(1 AS bigint)');
22var_dump($stmt->fetchColumn() === $expected);
23?>
24--EXPECT--
25bool(true)
26