php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20641 Numeric type returns invalid result using ibase_fetch_row/ibase_fetch_object
Submitted: 2002-11-26 03:24 UTC Modified: 2003-05-21 17:59 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: jear at aabc dot dk Assigned:
Status: Closed Package: InterBase related
PHP Version: 4.2.3 OS: Windows NT / Firebird 1.0
Private report: No CVE-ID:
 [2002-11-26 03:24 UTC] jear at aabc dot 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]); 
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-26 04:38 UTC] jear at aabc dot 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;
}
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();
 [2002-12-04 22:49 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-12-21 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-12-22 06:04 UTC] jear at aabc dot dk
The problem still exits after downloadning the latest PHP4 at http://snaps.php.net/win32/php4-win32-latest.zip.
 [2003-02-11 02:37 UTC] jear at aabc dot dk
I've tried the CVS snapshot for Windows:

  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

Unfortunately the numeric/decimal datatype beyond
the bounds of the PHP integer type (> 2147483647), still causes an overflow.


integer overflow is still there.
 [2003-03-13 16:13 UTC] daniela@php.net
Fixed in current CVS and php_4_3
 [2003-03-31 03:08 UTC] jear at aabc dot dk
I've tried current CVS and php_4_3 for Windows.

Unfortunately the numeric/decimal datatype beyond
the bounds of the PHP integer type (> 2147483647), still causes an overflow.

Example:
InterBase 2303511415 (decimal 10,0) returns 2147483647
 [2003-03-31 03:33 UTC] sniper@php.net
Make sure that you REALLY updated to the latest STABLE snaphot and ALL the dlls. (and you might need to reboot even)
(don't install anything when your webserver is running)

 [2003-04-03 13:33 UTC] jear at aabc dot dk
I've downloaded og installed the latest STABLE snaphot with ALL the dlls. After rebooting, the same erroneous number is returned from Interbase to PHP:

IB/Firebird datatype (decimal 10,0), value 2303511415 returns 2147483647.
 [2003-05-16 02:28 UTC] daniela@php.net
Fixed both in CVS and php_4_3.

http://snaps.php.net/
please, try using Stable(4.3.x-dev) build >= 15 May
 [2003-05-21 17:59 UTC] sniper@php.net
If it's fixed -> closed.

 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 03:01:55 2014 UTC