From: sms at inbox dot ru Operating system: Windows 2000 SP4 PHP version: 5.2.4 PHP Bug Type: PDO related Bug description: PDO ODBC: Lob doesn't work
Description: ------------ I try to get a long binary field from Microsoft SQL Server. This simple thing is quite problematic with PDO ODBC. I already reported bug #42765. Now I found a way to bypass it and faced another big problem. PDO returns long binary fields always as HEX string which is also corrupted. LOBs doesn't work at all... So there's simply no way to get correct binary data with PDO. So I'm forced to use ODBC unified extension. Reproduce code: --------------- <plaintext> <?php $dbh=new PDO('odbc:Driver={SQL Server};Server=localhost;Database=test','user','pass'); $s=$dbh->prepare("set textsize 10485760; select [nbin] from [atts] where [id]=1"); $s->bindColumn('nbin',$bin,PDO::PARAM_LOB); $s->execute(); $s->fetch(PDO::FETCH_BOUND); var_dump($bin); ?> Note: "set textsize" to bypass bug #42765 Expected result: ---------------- $bin should be a stream object Actual result: -------------- $bin is a string instead: string(385) "24733D246462682D3E707265706172652822736574205445585453495A452031303438353736303B2073656C656374206E62696E2066726F6D2074626C417474732077686572652069644174743D363222293B0D0A24732D3E62696E64436F6C756D6E28276E62696E272C2462696E2C50444F3A3A504152414D5F4C4F4229�3B0D0A24732D3E6578656375746528293B0D0A24732D3E66657463682850444F3A3A46455443485F424F554E44293B0D0A7661725F64756D70282462696E29��3B" Why is it HEX-coded anyway?.. pack("H*",$bin) gives warning "illegal hex digit" and the result differs from actual field value. -- Edit bug report at http://bugs.php.net/?id=42768&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42768&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42768&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42768&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42768&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42768&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42768&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42768&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42768&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42768&r=support Expected behavior: http://bugs.php.net/fix.php?id=42768&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42768&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42768&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42768&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42768&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42768&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42768&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42768&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42768&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42768&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42768&r=mysqlcfg