Bug #60052 [Com]: Integer returned as a 64bit integer on X64_86

From: Date: Wed, 15 Jan 2014 06:58:48 +0000
Subject: Bug #60052 [Com]: Integer returned as a 64bit integer on X64_86
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183802@lists.php.net to get a copy of this message
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 Firebird
 Operating System:   All (linux tested)
 PHP Version:        5.3.8
 Assigned To:        mariuz
 Block user comment: N
 Private report:     N

 New Comment:

may be it's time to move to Java with native POJO ? )


Previous Comments:
------------------------------------------------------------------------
[2014-01-03 02:40:48] papatiger+phpbug at gmail dot com

Why are many serious bugs of pdo.firebird not revised?
I cannot use ORM such as DBAL in Firebird.

------------------------------------------------------------------------
[2013-10-07 08:51:15] mariuz@php.net

I will recheck and apply it (the patch)

------------------------------------------------------------------------
[2013-09-25 18:22:14] slavb18 at gmail dot com

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
)

------------------------------------------------------------------------
[2012-04-02 14:04:37] mariuz@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


Thread (15 messages)

« previous php.bugs (#183802) next »