Bug 1931825 - PDO ODBC truncates BLOB records at every 256th byte
Summary: PDO ODBC truncates BLOB records at every 256th byte
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Software Collections
Classification: Red Hat
Component: php
Version: rh-php73
Hardware: All
OS: Linux
unspecified
high
Target Milestone: alpha
: 3.7
Assignee: Remi Collet
QA Contact: rhel-cs-infra-services-qe
URL:
Whiteboard:
Depends On:
Blocks: 1977764
TreeView+ depends on / blocked
 
Reported: 2021-02-23 10:47 UTC by asah
Modified: 2024-10-01 17:33 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1977764 (view as bug list)
Environment:
Last Closed: 2021-08-20 13:16:51 UTC
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)

Description asah 2021-02-23 10:47:31 UTC
Description of problem:
PDO ODBC truncates BLOB records at every 256th byte


Test script:
---------------
1. ODBC version:
$conn = odbc_connect("ORACLETEST", "user", "password");
$query = "SELECT pdf FROM PAYROLL WHERE USER_ID = 999 AND ROWNUM = 1 ORDER BY YEAR DESC, MONTH DESC";
if(!$conn) die("Connection failed");
if($result = odbc_exec($conn, $query))
{
    odbc_longreadlen($result, 131072);
    while(odbc_fetch_row($result)){
        print strlen(odbc_result($result,1));
    }
}

2. PDO ODBC version:
$pdo = new PDO("odbc:ORACLETEST", "user",  "password" );
$stmt = $pdo->prepare('SELECT pdf FROM PAYROLL WHERE USER_ID = 999 AND ROWNUM = 1 ORDER BY YEAR DESC, MONTH DESC');
$stmt->bindColumn(1, $data, PDO::PARAM_LOB);
$stmt->execute();
$stmt->fetch(PDO::FETCH_BOUND);
print strlen($data);

Upstream Fix:
https://github.com/php/php-src/pull/6716
https://bugs.php.net/bug.php?id=80783

Version-Release number of selected component (if applicable):
rh-php73-php-odbc-7.3.20-1.el7.x86_64
rh-php73-php-pdo-7.3.20-1.el7.x86_64



Expected result:
----------------
The actual data in the database is 25744 bytes long.


Actual result:
--------------
ODBC version returns with the length of 25744, and that's fine.

PDO ODBC version returns with the length of 25644 byte, which is 100 bytes smaller than expected.

Comment 4 Remi Collet 2021-04-08 07:25:06 UTC
Upstream fix (with tests)
https://github.com/php/php-src/commit/bccca0b53aa60a62e2988c750fc73c02d109e642

This will be in 7.4.18 and 8.0.5 planned for May (7.4.17 and 8.0.4 which have been delayed won't have it)

Comment 5 Remi Collet 2021-04-08 09:10:48 UTC
Looks like this extension have terrible side effects related to various drivers and different implementation

At least, I think we should wait for upstream feedback on
https://github.com/php/php-src/pull/6842

Comment 13 Joe Orton 2021-08-20 13:17:11 UTC
This issue was resolved via RHSCL errata https://access.redhat.com/errata/RHSA-2021:2992


Note You need to log in before you can comment on or make changes to this bug.