From:
Operating system: SUSE SLES 10 SP2
PHP version: 5.3.6
Package: ODBC related
Bug Type: Bug
Bug description:All ODBC Queries Return INTs as Strings For Multiple ODBC
Drivers
Description:
------------
odbc_* and PDO ODBC functions are each returning SQL integer values as PHP
strings. However, SQL NULL values properly appear as PHP NULL values.
I have tested against multiple ODBC providers (FreeTDS and iSeries Access
for
Linux).
System:
SUSE Enterprise Linux Server 10 (SP2) - 32bit
Linux dev-webhost1 2.6.16.60-0.42.5-default #1 Mon Aug 24 09:41:41 UTC 2009
i686
i686 i386 GNU/Linux
UnixODBC
PHP 5.3.6 from source
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-
mssql=/usr/local/freetds --with-ldap --prefix=/usr/local/php5
--with-config-
file-
path=/usr/local/php5/etc --enable-sockets --enable-soap --with-openssl
--with-
unixODBC=/usr --with-gd --with-jpeg-dir=/usr/lib
--with-pdo-odbc=unixODBC,/usr
Test script:
---------------
1. odbc_* against FreeTDS to SQL Server 2008:
$odbc = odbc_connect('hpsql3','--censored--','--censored--');
$or = odbc_exec($odbc,'SELECT 1');
var_dump(odbc_fetch_array($or)); // array( string "1" )
2. odbc_* against iSeries Access for Linux to AS/400:
$odbc = odbc_connect('iSeriesDSN','--','--');
$or = odbc_exec($odbc,'SELECT 1 FROM SYSIBM.SYSDUMMY1');
var_dump(odbc_fetch_array($or)); // array( string "1" )
3. PDO against FreeTDS to SQL Server 2008
$pdo = new PDO('odbc:hpsql3','--','--');
var_dump($pdo->query('SELECT 1')->fetch(PDO::FETCH_ASSOC)); // array
(string "1")
4. PDO against iSeries Access for Linux to AS/400
$pdo = new PDO('odbc:iSeriesDSN','--','--');
var_dump($pdo->query('SELECT 1 FROM
SYSIBM.SYSDUMMY1')->fetch(PDO::FETCH_ASSOC)); // array (string "1")
Expected result:
----------------
I expect to get arrays containing (int) 1
Actual result:
--------------
I actually get arrays containing (string) "1"
--
Edit bug report at https://bugs.php.net/bug.php?id=55291&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55291&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55291&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=55291&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55291&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=55291&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55291&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=55291&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=55291&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=55291&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=55291&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=55291&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=55291&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=55291&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55291&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=55291&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=55291&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=55291&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=55291&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=55291&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=55291&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=55291&r=mysqlcfg