php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53353 Error retrieving data from MDB database: column is DOUBLE
Submitted: 2010-11-19 10:10 UTC Modified: 2020-10-18 04:22 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: stefan dot mueller at meteotest dot ch Assigned: cmb (profile)
Status: No Feedback Package: ODBC related
PHP Version: Irrelevant OS: Windows 7
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: stefan dot mueller at meteotest dot ch
New email:
PHP Version: OS:

 

 [2010-11-19 10:10 UTC] stefan dot mueller at meteotest dot ch
Description:
------------
Test environment:
- Windows 7 32bit, PHP 5.2.9 and PHP 5.3.1., MS Access 2002 SP3
- ODBC 'DSN1': Microsoft Access Driver (*.mdb) 6.01.7600.16385
- ODBC 'DSN2': Microsoft Access Driver (*.mdb,*.adccdb) 14.00.4760.1000
- Test to access the database also performed with IDL (www.ittvis.com)

In the access database I have a value -0.0864691123456789 (this is 19 characters long which is important) in a column defined as DOUBLE.

When I connect to the database with 'DSN1' then I get an ASCII 0 back with PHP 5.2.9 and 5.3.1.
When I connect to the database with 'DSN2' then I get an 'E-2' (the exponent of the floating point number) back with PHP 5.2.9 and 5.3.1.
When I retrieve the data with IDL from 'DSN1' and 'DSN2' I get the correct numbers.

When I cut the last character in the access database -0.086469112345678 so that the cell contains only 18 characters, the correct numbers are retrieved with PHP.


Row from Access DB
163 12 1 1 x 132.449361609318 14.714402153458 75 3.08241316815042 -4.2982786671882 -8.64691123456789E-02 0


Test script:
---------------
$conn = odbc_connect("'DSN1' or 'DSN2', '', '')
    or die ("Could not connect to database.");
$sql  = "SELECT * FROM table;";
$res = odbc_exec($conn, $sql);
while ($x = odbc_fetch_array($res)){
    var_dump($x);
    if(!is_numeric($x['column'])) {
        var_dump(ord($x['column']));
    }
}
odbc_free_result($res);
odbc_close($conn);

Expected result:
----------------
array
  'ID' => string '163' (length=3)
  'CC' => string '12' (length=2)
  'Z3' => string '1' (length=1)
  'LFIREG' => string '1' (length=1)
  'orgBoden' => string 'x' (length=1)
  'cl' => string '132.449361609318' (length=16)
  'cd' => string '14.714402153458' (length=15)
  'cs' => string '75.0' (length=4)
  'incr_cl' => string '3.08241316815042' (length=16)
  'decr_cl' => string '-4.2982786671882' (length=16)
  'd_cd' => string '-0.0864691123456789' (length=19)
  'd_cs' => string '0.0' (length=3)


Actual result:
--------------
array
  'ID' => string '163' (length=3)
  'CC' => string '12' (length=2)
  'Z3' => string '1' (length=1)
  'LFIREG' => string '1' (length=1)
  'orgBoden' => string 'x' (length=1)
  'cl' => string '132.449361609318' (length=16)
  'cd' => string '14.714402153458' (length=15)
  'cs' => string '75.0' (length=4)
  'incr_cl' => string '3.08241316815042' (length=16)
  'decr_cl' => string '-4.2982786671882' (length=16)
  'd_cd' => string '�' (length=1)
  'd_cs' => string '0.0' (length=3)

int 0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-19 10:17 UTC] stefan dot mueller at meteotest dot ch
Changing the Testenvironment to:
Windows XP with Microsoft Access Driver (*.mdb) 4.x
It works as expected with PHP 5.2.9 and 5.3.1.
 [2020-10-05 08:55 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-10-05 08:55 UTC] cmb@php.net
Can you still reproduce this with any of the actively supported
PHP versions[1]?  If so, please provide a self-contained reproduce
script, i.e. a script which creates the required database table
(or provide an .mdb which exhibits the behavior somewhere for
download).

[1] <https://www.php.net/supported-versions.php>
 [2020-10-18 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 04:01:30 2024 UTC