Issue Bug Closed

#20427DBAL - bigint (int8) values get converted to int4 by int-cast

Michael Mondl 05/15/09, 13:15 updated 05/23/10, 12:59

Description

In my current project I have to use DBAL with MSSQL 2005 Enterprise.

Before a bigint value is stored to the db (INSERT and UPDATE), the bigint is casted to int by the following statement:
$v = (($mt{0}==‘I’)||($mt{0}==‘F’)) ? (int)$v : $v;

This statement can be found in file
typo3/sysext/dbal/class.ux_t3lib_db.php
at line 833 and 761.

Usually (32bit environment) php ints are of type int4 and therefore cut bigint values.

My current workaround is to change both statements to:
$v = (($mt{0}==‘I’)||($mt{0}==‘F’)) ? ereg_replace(‘[^[:digit:]]’, ‘’, $v) : $v;

I think this issue is similar to issue #0010965 which describes similiar problems with casting of float values.

PHP: 5.2.6
MSSQL: MSSQL Server 2005 Enterprise Edition
Typo3: 4.2.6
DBAL: 0.9.20
(issue imported from #M11093)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.