go to bug id or search bugs for
Integer on firebird is treated as a 32 bit int and int64 is used as a 64 bit integer.
In the pdo_firebird driver INT64 is not implemented and LONG (int32) is treated as a long integer. On an x86_64 machine this means that a SQL_LONG doesn't honor the bit-sign in a value and INT64 doesn't return anything.
This patch should fix this value for x86_64 systems while leaving x86 systems unchanged.
any firebirdSQL database with a integer field containing a negative value.
retrieve the value with the pdo_firebird driver on a 64 bit machine and echo it to the screen.
negative values with integer and should be returned as a negative number.
negative values are returned as their unsigned counterpart.
Add a Patch
Add a Pull Request
LL_MASK it should be already be "l" see the php_pdo_firebird_int.h:# define
So in the in the slprintf
slprintf(*ptr, CHAR_BUF_LEN, "%" LL_MASK "d", *(ISC_INT64*)var->sqldata);
should be replaced with
slprintf(*ptr, CHAR_BUF_LEN, "%" "l" "d", *(ISC_INT64*)var->sqldata);
I will check and create a test for 5.3.x
why this patch only partially accepted? still not working on x86-64
$q="select * FROM RDB\$DATABASE";
[RI] => 4294967295
 => 4294967295
[RI] => -1
 => -1
I will recheck and apply it (the patch)
Why are many serious bugs of pdo.firebird not revised?
I cannot use ORM such as DBAL in Firebird.
may be it's time to move to Java with native POJO ? )
bug and patch are three years old, looks like this is not need to anybody
I am running into the same problem and it seems that it's still not fixed (at least I do not find any relevant changes in the repository).
Maybe Firebird is not as popular as other DBMS, but I cannot imagine that nobody needs negative values in 32bit-integers.
I am such dissapointed: the problem is still not fixed in current PHP 7.0 RC6 :-(
Please, please fix it...
Does this confirm that nobody actually uses Firebird? For a bug like this, which effects simple day to day operations such as wanting to use a negative number, to remain open, despite a patch having been offered, for this many years, I find incredible.
I ported code from ibase specific stuff to PDO in anticipation of having to ditch Firebird for other reasons. This confirms its fate.
Automatic comment on behalf of firstname.lastname@example.org
Log: Fix Bug #60052 Integer returned as a 64bit integer on X64_86 for pdo_firebird
The commited patch doesn't work. The change bellow appends "ld" to the number.
- *len = slprintf(*ptr, CHAR_BUF_LEN, "%" LL_MASK "d", *(ISC_INT64*)var->sqldata);
+ *len = slprintf(*ptr, CHAR_BUF_LEN, "%ld" LL_MASK "d", *(ISC_INT64*)var->sqldata);
I think just the single change in the earlier patch is required. At least that worked for me.
we are using php5-bug60052.patch with single change since 2013-09-26, no problems
I have reverted that patch , it wasn't needed