#20641 [Opn]: Numeric type returns invalid result using ibase_fetch_row/ibase_fetch_object

From: Date: Tue, 26 Nov 2002 10:38:20 +0000
Subject: #20641 [Opn]: Numeric type returns invalid result using ibase_fetch_row/ibase_fetch_object
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-25840@lists.php.net to get a copy of this message
ID: 20641 User updated by: jear@aabc.dk Reported By: jear@aabc.dk Status: Open Bug Type: InterBase related -Operating System: Windows XP / Firebird 1.0 +Operating System: Windows NT / Firebird 1.0 PHP Version: 4.2.3 New Comment: Numeric type returns invalid result using ibase_fetch_row/ibase_fetch_object (Windows NT). Numbers stored as an InterBase/Firebird numeric/decimal datatype beyond the bounds of the PHP integer type (> 2147483647), do not return a float type but cause an overflow Example: 2303511415 (decimal 10,0) returns -1991455881 PHP/Firebird example script: $sql = "create table temp (large_number numeric(10,0))"; $result = ibase_query($sql,connection()); if (!$result) { exit; } ibase_commit(); $sql = "INSERT INTO temp VALUES (2303511415)"; $result = ibase_query($sql,connection()); if (!$result) { exit; } $sql = "SELECT large_number FROM temp WHERE large_number = 2303511415"; $result = ibase_query($sql,connection()); if (!$result) { exit; } while ($row = ibase_fetch_row($result)) { print($row[0]); } ibase_free_result($result); $sql = "drop table temp"; $result = ibase_query($sql,connection()); if (!$result) { exit; } ibase_commit(); Previous Comments: ------------------------------------------------------------------------ [2002-11-26 03:24:19] jear@aabc.dk Numeric type returns invalid result using ibase_fetch_row/ibase_fetch_object (Windows NT). Numbers stored as an InterBase/Firebird numeric/decimal datatype beyond the bounds of the PHP integer type (> 2147483647), do not return a float type but cause an overflow Example: 2303511415 (decimal 10,0) returns -1991455881 PHP/Firebird example script: $sql = "create table temp (large_number numeric(10,0))"; $result = ibase_query($sql,connection()); if (!$result) { exit; } $sql = "INSERT INTO temp VALUES (2303511415)"; $result = ibase_query($sql,connection()); if (!$result) { exit; } $sql = "SELECT large_number FROM temp WHERE large_number = 2303511415"; $result = ibase_query($sql,connection()); if (!$result) { exit; } while ($row = ibase_fetch_row($result)) { print($row[0]); } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=20641&edit=1

« previous php.bugs (#25840) next »