Bug #80868 [NEW]: Missing bytes with DB2 column type LOB
| From: | rick dot meertens at gmail dot com | Date: | Mon, 15 Mar 2021 12:34:37 +0000 |
| Subject: | Bug #80868 [NEW]: Missing bytes with DB2 column type LOB | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-232727@lists.php.net to get a copy of this message | ||
From: rick dot meertens at gmail dot com
Operating system: Windows
PHP version: 7.3.27
Package: PDO ODBC
Bug Type: Bug
Bug description:Missing bytes with DB2 column type LOB
Description:
------------
While reading a BLOB(1MB) field from an AS400 DB2 database with the PDO
ODBC - IBM i Access ODBC driver we are missing 7 hex chars every 255th
position in the stream.
I am using PHP 7.3.27 with the underlying
IBMiAccess_v1r1_WindowsAP_English v1.1.8.6 ODBC driver.
-Install the IBM iAccess ODBC driver.
-Enable PHP extension pdo_odbc.
-Create a column with type blob and length 1048576;
-Fill a blob field with:
for($i = 0; $i<50; $i++)
{
$blobData=$blobData."abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
}
-Read it with script below.
Test script:
---------------
//credentials
$db_host = '';
$db_user = '';
$db_pass = '';
$table = '';
$blob_field = '';
$id_field = '';
$id = '';
$connection = new PDO("odbc:Driver={iSeries Access ODBC
Driver};System=$db_host;UID=$db_user;PWD=$db_pass;");
$sql = "SELECT $blob_field FROM $table WHERE $id_field = ?";
$stmt = $connection->prepare($sql);
if(!$stmt) {throw new Exception("Error while executing prepare: $sql
[".$connection->errorInfo()."]");}
if(!$stmt->execute(array($id))) { throw new Exception("Error while
executing query() execute: $sql [".$connection->errorInfo()."]");}
$stmt->bindColumn(1, $lob, PDO::PARAM_LOB);
$stmt->fetch(PDO::FETCH_BOUND);
echo $lob;
//hexToAscii($lob)
Expected result:
----------------
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A666C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
61626364 etcetera
Actual result:
--------------
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636
68696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A66
F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F707172737475767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
6162636465666768696A6B6C6D6E6F70717
767778797A4142434445464748494A4B4C4D4E4F505152535455565758595A30313233343536373839
61626364 etcetera
--
Edit bug report at https://bugs.php.net/bug.php?id=80868&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80868&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80868&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80868&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80868&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80868&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80868&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80868&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80868&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80868&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80868&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80868&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80868&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80868&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80868&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80868&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80868&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80868&r=mysqlcfg