From:
Operating system: Windows 7
PHP version: Irrelevant
Package: ODBC related
Bug Type: Bug
Bug description:Error retrieving data from MDB database: column is DOUBLE
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
--
Edit bug report at http://bugs.php.net/bug.php?id=53353&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=53353&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=53353&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=53353&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=53353&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=53353&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=53353&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=53353&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=53353&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=53353&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=53353&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=53353&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=53353&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=53353&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=53353&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53353&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53353&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=53353&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=53353&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=53353&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=53353&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=53353&r=mysqlcfg