Edit report at https://bugs.php.net/bug.php?id=60052&edit=1

 ID:                 60052
 Comment by:         slavb18 at gmail dot com
 Reported by:        m dot vanduren at jonker dot nl
 Summary:            Integer returned as a 64bit integer on X64_86
 Status:             Assigned
 Type:               Bug
 Package:            PDO related
 Operating System:   All (linux tested)
 PHP Version:        5.3.8
 Assigned To:        mariuz
 Block user comment: N
 Private report:     N

 New Comment:

why this patch only partially accepted? still not working on x86-64
$q="select * FROM RDB\$DATABASE";
$q="execute block
returns (
rI integer)
as
begin
rI= -1;
suspend;
end";
$res=$pdo->dbExecute($q);
print_r($res->fetch());

outputs
Array
(
    [RI] => 4294967295
    [0] => 4294967295
)
istead of
Array
(
    [RI] => -1
    [0] => -1
)


Previous Comments:
------------------------------------------------------------------------
[2012-04-02 14:04:37] mar...@php.net

LL_MASK it should be already be "l" see the php_pdo_firebird_int.h:# define 
LL_MASK "l"

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

------------------------------------------------------------------------
[2011-10-13 13:01:36] m dot vanduren at jonker dot nl

Description:
------------
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.

Test script:
---------------
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.

Expected result:
----------------
negative values with integer and should be returned as a negative number.

Actual result:
--------------
negative values are returned as their unsigned counterpart.


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60052&edit=1

Reply via email to