php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #863 PHP returns bad values for 'REAL' columns coming from sybase
Submitted: 1998-10-21 12:22 UTC Modified: 1999-11-05 03:53 UTC
From: bb26 at chrysler dot com Assigned:
Status: Closed Package: Sybase (dblib) related
PHP Version: 3.0.5 OS: AIX 4.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bb26 at chrysler dot com
New email:
PHP Version: OS:

 

 [1998-10-21 12:22 UTC] bb26 at chrysler dot com
This problem exists in 3.0.3 and 3.0.5 and probably other versions. Sybase versions tested were 11.0.3 and ASE 11.5.1 running on AIX 4.3 and Digital Unix 4.0d.  PHP was running as an apache (1.3.3) module on AIX 4.3 on 64-bit hardware.

The following patch fixes the problem for me, but someone else probably needs to try it out to make sure I didn't break something else.

*** php3_sybase.h       Sun Oct  4 20:22:42 1998
--- php3_sybase.h.new   Wed Oct 21 11:43:37 1998
***************
*** 91,96 ****
--- 91,97 ----
  #define anyintcol(j) (coltype(j)==SYBINT4?intcol(j):(coltype(j)==SYBINT2?small
intcol(j):tinyintcol(j)))
  #define charcol(i) ((DBCHAR *) dbdata(sybase_ptr->link,i))
  #define floatcol(i) ((float) *(DBFLT8 *) dbdata(sybase_ptr->link,i))
+ #define realcol(i) ((float) *(DBREAL *) dbdata(sybase_ptr->link,i))

  typedef struct sybase_link_struct sybase_link;


*** sybase.c    Sun Oct  4 20:23:05 1998
--- sybase.c.new        Wed Oct 21 11:43:01 1998
***************
*** 626,634 ****
                        result->type = IS_STRING;
                        break;
                }
!               /*case SYBFLT8:*/
!               case SYBREAL: {
                        result->value.dval = (double) floatcol(offset);
                        result->type = IS_DOUBLE;
                        break;
                }
--- 626,637 ----
                        result->type = IS_STRING;
                        break;
                }
!               case SYBFLT8:
                        result->value.dval = (double) floatcol(offset);
+                       result->type = IS_DOUBLE;
+                       break;
+               case SYBREAL: {
+                       result->value.dval = (double) realcol(offset);
                        result->type = IS_DOUBLE;
                        break;
                }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-05 03:53 UTC] thies at cvs dot php dot net
fixed in cvs - handled by default case
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 17:01:30 2024 UTC