php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80783 PDO ODBC truncates BLOB records at every 256th byte
Submitted: 2021-02-22 10:12 UTC Modified: 2021-02-23 11:43 UTC
From: horvath dot szabolcs at t-systems dot hu Assigned: cmb (profile)
Status: Closed Package: PDO ODBC
PHP Version: 7.3.27 OS: Red Hat Enterprise Linux Server
Private report: No CVE-ID: None
 [2021-02-22 10:12 UTC] horvath dot szabolcs at t-systems dot hu
Description:
------------
Hi,

We're using PHP 7.3.20 from Red Hat Software Collections. 
Although 7.3.27 is out there, I read thoroughly the changelog and haven't found similar bug between 7.3.20 and 7.3.27.

There is a BLOB record in the database (Oracle 19c) which can be read with php-odbc and can't with php-pdo.

We have a test case (see next chapter).

The Oracle ODBC trace outputs for both PDO and ODBC version have been attached.

It seems that ODBC is capable for reading the BLOB in a 25.744 bytes length chunk:

[ODBC][26948][1613745870.667436][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e06001e950
                        Column Number = 1
                        Target Type = -2 SQL_C_BINARY
                        Buffer Length = 131072
                        Target Value = 0x7f4fed496018
                        StrLen Or Ind = 0x7f4fed403388
[ODBC][26948][1613745870.668021][SQLGetData.c][545]
                Exit:[SQL_SUCCESS]
                        Buffer = [BINARYDATA...]
                        Strlen Or Ind = 0x7f4fed403388 -> 25744

While PDO reads it in a loop with 256 byte length chunks:

[ODBC][32334][1613745953.051520][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [UDEyRGJHdDdYdys0US9BNGxPaWpTbmJ2Q1lBSFFOczBLVUx0TnNTaHBCcjF6WEZ2dm9XZWt3VUtRSmJGVmJmRHBnWWg0MlhjckdTZjJBWWkvMG14VWNYT3htUm5BTy9m]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 25744
[ODBC][32334][1613745953.051771][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f100
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.051995][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [Q3c3OGI2bnJycmVQMktmc2VNOWRmZ2c1ZVJDUUh0bFZNZCsyMWRjRHZnVTBrRjlCTE4wMWRKUTl4YjhkSDdoN3NBSTF0akdLT2ZvVGlTU3R6RnZJQmhSVGNGU3ZkRUxp]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 25488
[ODBC][32334][1613745953.052224][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f100
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.052459][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [K0wzTHZabE1KejhOcHpIblVuYXJzTktXTmdvWEw0YlNPa2l0b0FTNkNvOFVtc1hzYnNXTGErVnVDbXVXUHdLTGZTWGtIUHR0aDVwZU1LRS9DNDlONVhKSjN2S21zOFl2]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 25232

I suspect at every 256 bytes length read there is one character truncated. 

Versions:
rh-php73-php-odbc-7.3.20-1.el7.x86_64
rh-php73-php-pdo-7.3.20-1.el7.x86_64

https://github.com/php/php-src/blob/master/ext/pdo_odbc/odbc_stmt.c contains a lot of references for 256 bytes boundary.

Here is a similar php pdo_odbc issue (https://github.com/microsoft/msphpsql/issues/1052) which matches, but it has not been solved (the caller moved on to pdo_sqlsrv instead of pdo_odbc)

Thank you in advance.

Best regards
  Szabolcs Horvath

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);

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.


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-22 10:15 UTC] horvath dot szabolcs at t-systems dot hu
Actual php-odbc trace:

[ODBC][26948][1613745870.512493][SQLConnect.c][3721]
                Entry:
                        Connection = 0x55e05fd3fb90
                        Server Name = [ORACLETEST][length = 11 (SQL_NTS)]
                        User Name = [user][length = 11 (SQL_NTS)]
                        Authentication = [********][length = 8 (SQL_NTS)]
                UNICODE Using encoding ASCII 'UTF-8' and UNICODE 'UTF16LE'

[ODBC][26948][1613745870.647085][SQLConnect.c][4299]
                Exit:[SQL_SUCCESS]
[ODBC][26948][1613745870.647748][SQLAllocHandle.c][540]
                Entry:
                        Handle Type = 3
                        Input Handle = 0x55e05fd3fb90
[ODBC][26948][1613745870.648513][SQLAllocHandle.c][1085]
                Exit:[SQL_SUCCESS]
                        Output Handle = 0x55e06001e950
[ODBC][26948][1613745870.649134][SQLGetInfo.c][236]
                Entry:
                        Connection = 0x55e05fd3fb90
                        Info Type = SQL_FETCH_DIRECTION (8)
                        Info Value = 0x7fff66837184
                        Buffer Length = 4
                        StrLen = (nil)
[ODBC][26948][1613745870.649701][SQLSetStmtOption.c][197]
                Entry:
                        Statement = 0x55e06001e950
                        Option = SQL_ATTR_CURSOR_TYPE
                        Value = 3
[ODBC][26948][1613745870.650504][SQLSetStmtOption.c][477]
                Exit:[SQL_SUCCESS]
[ODBC][26948][1613745870.650884][SQLExecDirect.c][240]
                Entry:
                        Statement = 0x55e06001e950
                        SQL = [SELECT pdf FROM PAYROLL WHERE USER_ID = 999 AND ROWNUM = 1 ORDER BY YEAR DESC, MONTH DESC][length = 89 (SQL_NTS)]
[ODBC][26948][1613745870.657670][SQLExecDirect.c][521]
                Exit:[SQL_SUCCESS]
[ODBC][26948][1613745870.658258][SQLNumResultCols.c][156]
                Entry:
                        Statement = 0x55e06001e950
                        Column Count = 0x7f4fed402358
[ODBC][26948][1613745870.658848][SQLNumResultCols.c][251]
                Exit:[SQL_SUCCESS]
                        Count = 0x7f4fed402358 -> 1
[ODBC][26948][1613745870.659390][SQLColAttribute.c][294]
                Entry:
                        Statement = 0x55e06001e950
                        Column Number = 1
                        Field Identifier = SQL_DESC_NAME
                        Character Attr = 0x7f4fed403280
                        Buffer Length = 256
                        String Length = 0x7fff66837092
                        Numeric Attribute = (nil)
[ODBC][26948][1613745870.659942][SQLColAttribute.c][709]
                Exit:[SQL_SUCCESS]
[ODBC][26948][1613745870.660461][SQLColAttribute.c][294]
                Entry:
                        Statement = 0x55e06001e950
                        Column Number = 1
                        Field Identifier = SQL_DESC_CONCISE_TYPE
                        Character Attr = (nil)
                        Buffer Length = 0
                        String Length = (nil)
                        Numeric Attribute = 0x7f4fed403390
[ODBC][26948][1613745870.660998][SQLColAttribute.c][709]
                Exit:[SQL_SUCCESS]
[ODBC][26948][1613745870.661602][SQLExtendedFetch.c][166]
                Entry:
                        Statement = 0x55e06001e950
                        Fetch Type = 1
                        Row = 1
                        PcRow = 0x7fff66837190
                        Row Status = 0x7fff66837170
[ODBC][26948][1613745870.666906][SQLExtendedFetch.c][339]
                Exit:[SQL_SUCCESS]
[ODBC][26948][1613745870.667436][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e06001e950
                        Column Number = 1
                        Target Type = -2 SQL_C_BINARY
                        Buffer Length = 131072
                        Target Value = 0x7f4fed496018
                        StrLen Or Ind = 0x7f4fed403388
[ODBC][26948][1613745870.668021][SQLGetData.c][545]
                Exit:[SQL_SUCCESS]
                        Buffer = [BINARYDATA...]
                        Strlen Or Ind = 0x7f4fed403388 -> 25744
[ODBC][26948][1613745870.668576][SQLExtendedFetch.c][166]
                Entry:
                        Statement = 0x55e06001e950
                        Fetch Type = 1
                        Row = 1
                        PcRow = 0x7fff66837190
                        Row Status = 0x7fff66837170
[ODBC][26948][1613745870.669176][SQLExtendedFetch.c][339]
                Exit:[SQL_NO_DATA]
[ODBC][26948][1613745870.669937][SQLFreeStmt.c][144]
                Entry:
                        Statement = 0x55e06001e950
                        Option = 1
[ODBC][26948][1613745870.670454][SQLFreeHandle.c][387]
                Entry:
                        Handle Type = 3
                        Input Handle = 0x55e06001e950
[ODBC][26948][1613745870.671122][SQLFreeHandle.c][490]
                Exit:[SQL_SUCCESS]
[ODBC][26948][1613745870.671663][SQLDisconnect.c][208]
                Entry:
                        Connection = 0x55e05fd3fb90
[ODBC][26948][1613745871.630195][SQLDisconnect.c][379]
                Exit:[SQL_SUCCESS]
[ODBC][26948][1613745871.630471][SQLFreeHandle.c][290]
                Entry:
                        Handle Type = 2
                        Input Handle = 0x55e05fd3fb90
[ODBC][26948][1613745871.630712][SQLFreeHandle.c][339]
                Exit:[SQL_SUCCESS]
[ODBC][26948][1613745871.630939][SQLFreeHandle.c][220]
                Entry:
                        Handle Type = 1
                        Input Handle = 0x55e05fd305c0
 [2021-02-22 10:17 UTC] horvath dot szabolcs at t-systems dot hu
Actual php-pdo trace:

[ODBC][32334][1613745952.889923][SQLConnect.c][3721]
                Entry:
                        Connection = 0x55e05fc8d200
                        Server Name = [ORACLETEST][length = 11 (SQL_NTS)]
                        User Name = [user][length = 11 (SQL_NTS)]
                        Authentication = [********][length = 8 (SQL_NTS)]
                UNICODE Using encoding ASCII 'UTF-8' and UNICODE 'UTF16LE'

[ODBC][32334][1613745953.041731][SQLConnect.c][4299]
                Exit:[SQL_SUCCESS]
[ODBC][32334][1613745953.042039][SQLAllocHandle.c][540]
                Entry:
                        Handle Type = 3
                        Input Handle = 0x55e05fc8d200
[ODBC][32334][1613745953.042303][SQLAllocHandle.c][1085]
                Exit:[SQL_SUCCESS]
                        Output Handle = 0x55e05fe1fd30
[ODBC][32334][1613745953.042520][SQLPrepare.c][196]
                Entry:
                        Statement = 0x55e05fe1fd30
                        SQL = [SELECT pdf FROM PAYROLL WHERE USER_ID = 999 AND ROWNUM = 1 ORDER BY YEAR DESC, MONTH DESC][length = 89 (SQL_NTS)]
[ODBC][32334][1613745953.042850][SQLPrepare.c][377]
                Exit:[SQL_SUCCESS]
[ODBC][32334][1613745953.043093][SQLExecute.c][187]
                Entry:
                        Statement = 0x55e05fe1fd30
[ODBC][32334][1613745953.044674][SQLExecute.c][357]
                Exit:[SQL_SUCCESS]
[ODBC][32334][1613745953.044917][SQLRowCount.c][173]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Row Count = 0x7fff668370c8
[ODBC][32334][1613745953.045158][SQLRowCount.c][247]
                Exit:[SQL_SUCCESS]
                        Row Count = 0x7fff668370c8 -> -1
[ODBC][32334][1613745953.045373][SQLNumResultCols.c][156]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Count = 0x7fff668370d0
[ODBC][32334][1613745953.045602][SQLNumResultCols.c][251]
                Exit:[SQL_SUCCESS]
                        Count = 0x7fff668370d0 -> 1
[ODBC][32334][1613745953.045871][SQLDescribeCol.c][247]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Column Name = 0x7f4fed4810da
                        Buffer Length = 127
                        Name Length = 0x7fff66837096
                        Data Type = 0x7f4fed4810d8
                        Column Size = 0x7fff66837098
                        Decimal Digits = (nil)
                        Nullable = (nil)
[ODBC][32334][1613745953.046112][SQLDescribeCol.c][504]
                Exit:[SQL_SUCCESS]
                        Column Name = [PDF]
                        Data Type = 0x7f4fed4810d8 -> -4
                        Column Size = 0x7fff66837098 -> 2147483647
                        Decimal Digits = NULLPTR
                        Nullable = NULLPTR
[ODBC][32334][1613745953.046327][SQLColAttribute.c][294]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Field Identifier = SQL_DESC_DISPLAY_SIZE
                        Character Attr = (nil)
                        Buffer Length = 0
                        String Length = (nil)
                        Numeric Attribute = 0x7fff668370a0
[ODBC][32334][1613745953.046550][SQLColAttribute.c][709]
                Exit:[SQL_SUCCESS]
[ODBC][32334][1613745953.046789][SQLFetchScroll.c][159]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Fetch Orentation = 1
                        Fetch Offset = 0
[ODBC][32334][1613745953.051041][SQLFetchScroll.c][356]
                Exit:[SQL_SUCCESS]
[ODBC][32334][1613745953.051281][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f000
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.051520][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [UDEyRGJHdDdYdys0US9BNGxPaWpTbmJ2Q1lBSFFOczBLVUx0TnNTaHBCcjF6WEZ2dm9XZWt3VUtRSmJGVmJmRHBnWWg0MlhjckdTZjJBWWkvMG14VWNYT3htUm5BTy9m]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 25744
[ODBC][32334][1613745953.051771][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f100
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.051995][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [Q3c3OGI2bnJycmVQMktmc2VNOWRmZ2c1ZVJDUUh0bFZNZCsyMWRjRHZnVTBrRjlCTE4wMWRKUTl4YjhkSDdoN3NBSTF0akdLT2ZvVGlTU3R6RnZJQmhSVGNGU3ZkRUxp]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 25488
[ODBC][32334][1613745953.052224][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f100
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.052459][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [K0wzTHZabE1KejhOcHpIblVuYXJzTktXTmdvWEw0YlNPa2l0b0FTNkNvOFVtc1hzYnNXTGErVnVDbXVXUHdLTGZTWGtIUHR0aDVwZU1LRS9DNDlONVhKSjN2S21zOFl2]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 25232
[ODBC][32334][1613745953.052681][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f100
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.052908][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [NjEzbVVOK0pWRG55YnRvVDFoZENjYTFsdC9LbHk4N3JFRGhySkhBLzAyVFNYV3ROOUhhcU9RQnMwc1R1eUJoWitURmxMTkJIQUloeXVTeXJPR1F3djdLaElVZWMvZHcz]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 24976
[ODBC][32334][1613745953.053126][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f100
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.053434][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [YkpYNHl6K2drVXpYUVREV1NmczlUS0J3aGZadVhoZzRRNlZ1MW92OW12bHZXYnh4M09adXVhNnRFcHdJcVFjTyszUHowL3lxanpDMElZb0tRcXlIZk8ybHRFaDBOU29E]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 24720
[ODBC][32334][1613745953.053676][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f100
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.053902][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [c3JMeUtWWCsxT2J2U0FvUXc4TnBOWndLUFdnZGgrNUt4ZlpCSGIxSmF4NitFVEJoN0lEVnA0a21kMS96YlZDQktOQVZYcjRqKzdWelZRdmwxT1pBTkorWWF2cHF5UXJt]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 24464
[ODBC][32334][1613745953.054120][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f100
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.054342][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [RnF6MmNJbkRxQ05kcHdpdHQ5ZWtDVUpUNCtYTjY0VkR5RFo1Z0gxRFplUVRRNExGRWRFRFBEWU9UeG45c2pEcmc1aGZRWXRwUDZxcXF1UzlYQm95M3owbXVUV2plbnBG]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 24208
[ODBC][32334][1613745953.054596][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f100
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.054897][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [UUxVMG9wRXpIOG5kMTVkeW9kelhob2JIYVVBZmJvM2RYS2ZDUnNCSENWeVRmamV5akdyaHRhczV1YnJldHR1KzQwSG1zRk5yUEVob1N3SExUS3cxeFJ4WTRNeGVnajN4]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 23952

[ it goes on and on until we have data ]

[ODBC][32334][1613745953.094878][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [MzY1c3RkQTBjRFUvYkFuTFZpSndVMFlXSE9nTi83Z29IZUUzZC9lVGFlV1RrNW8rYjR4TlBtRzJiYUUwMi9EYUtkd2Jpa08rUmFLd3E3eW9lQVZZWU1tdTcvaXY3dGV3]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 656
[ODBC][32334][1613745953.095072][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f100
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.095271][SQLGetData.c][545]
                Exit:[SQL_SUCCESS_WITH_INFO]
                        Buffer = [SHhSMjRxRVc3MUVWU1g1b3FjdjVTdFRJT2FvZWlDKzlVd0I3K25iRk5BWjV1SVR4OXNlOVlJRngxb3daMHF3eEZ4dmg0TEpIRWVUQUhqaExnL0ppSkE2WlFJNnU0S3lB]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 400
[ODBC][32334][1613745953.095459][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f100
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.095656][SQLGetData.c][545]
                Exit:[SQL_SUCCESS]
                        Buffer = [SHUvOG1iWTNBeFhvRTlqbVZwM0hyWGtPVEZEdFdaOXBCZjNWM2ZmYk5kSDM5MUFTYVZVa1ZRSm5yc1NONDhCTlhPenF1UWc0Rjlralcwd2ljbHU2UXpzZXhFY0xCeUU0]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 144
[ODBC][32334][1613745953.095871][SQLGetData.c][237]
                Entry:
                        Statement = 0x55e05fe1fd30
                        Column Number = 1
                        Target Type = 1 SQL_CHAR
                        Buffer Length = 256
                        Target Value = 0x7f4fed48f100
                        StrLen Or Ind = 0x7f4fed4810d0
[ODBC][32334][1613745953.096079][SQLGetData.c][545]
                Exit:[SQL_NO_DATA]
                        Buffer = [SHUvOG1iWTNBeFhvRTlqbVZwM0hyWGtPVEZEdFdaOXBCZjNWM2ZmYk5kSDM5MUFTYVZVa1ZRSm5yc1NONDhCTlhPenF1UWc0Rjlralcwd2ljbHU2UXpzZXhFY0xCeUU0]
                        Strlen Or Ind = 0x7f4fed4810d0 -> 0
[ODBC][32334][1613745953.096325][SQLCloseCursor.c][139]
                Entry:
                        Statement = 0x55e05fe1fd30
[ODBC][32334][1613745953.096554][SQLCloseCursor.c][234]
                Exit:[SQL_SUCCESS]
[ODBC][32334][1613745953.096748][SQLFreeHandle.c][387]
                Entry:
                        Handle Type = 3
                        Input Handle = 0x55e05fe1fd30
[ODBC][32334][1613745953.097007][SQLFreeHandle.c][490]
                Exit:[SQL_SUCCESS]
[ODBC][32334][1613745953.097206][SQLEndTran.c][417]
                Entry:
                        Connection = 0x55e05fc8d200
                        Completion Type = 1
[ODBC][32334][1613745953.098604][SQLGetInfo.c][236]
                Entry:
                        Connection = 0x55e05fc8d200
                        Info Type = SQL_CURSOR_COMMIT_BEHAVIOR (23)
                        Info Value = 0x55e05fc8e678
                        Buffer Length = 2
                        StrLen = 0x7fff66839160
[ODBC][32334][1613745953.098859][SQLGetInfo.c][236]
                Entry:
                        Connection = 0x55e05fc8d200
                        Info Type = SQL_CURSOR_ROLLBACK_BEHAVIOR (24)
                        Info Value = 0x55e05fc8e67a
                        Buffer Length = 2
                        StrLen = 0x7fff66839160
[ODBC][32334][1613745953.099083][SQLEndTran.c][566]
                Exit:[SQL_SUCCESS]
[ODBC][32334][1613745953.099399][SQLDisconnect.c][208]
                Entry:
                        Connection = 0x55e05fc8d200
[ODBC][32334][1613745954.023690][SQLDisconnect.c][379]
                Exit:[SQL_SUCCESS]
[ODBC][32334][1613745954.024410][SQLFreeHandle.c][290]
                Entry:
                        Handle Type = 2
                        Input Handle = 0x55e05fc8d200
[ODBC][32334][1613745954.024992][SQLFreeHandle.c][339]
                Exit:[SQL_SUCCESS]
[ODBC][32334][1613745954.025527][SQLFreeHandle.c][220]
                Entry:
                        Handle Type = 1
                        Input Handle = 0x55e05feb7150
 [2021-02-22 14:21 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #80783: PDO ODBC truncates BLOB records at every 256th byte
On GitHub:  https://github.com/php/php-src/pull/6716
Patch:      https://github.com/php/php-src/pull/6716.patch
 [2021-02-22 14:21 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-02-22 14:24 UTC] cmb@php.net
Could you please *test* the patch?  Note though, that PHP 7.3 is
no longer actively supported, so the patch targets PHP 7.4.  It
may still work with PHP 7.3, though.
 [2021-02-23 08:20 UTC] horvath dot szabolcs at t-systems dot hu
Thank for your quick response! It seems the bug has been fixed.
Nice job.

Anyone coming from RHEL systems: I opened a support ticket (Case 02876261) asking for a backport to their SCL tree.
 [2021-02-23 11:43 UTC] cmb@php.net
Thanks for the swift reply and confirmation!  Note, though, that
the PR has not yet been merged, and I'm actually surprised that it
fixes the issue for you, since your ODBC trace hints at missing
trailing NUL bytes, for what the patch doesn't cater to.
Particularly, there is likely an assertion failure with debug
builds.
 [2021-03-18 14:29 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=bccca0b53aa60a62e2988c750fc73c02d109e642
Log: Fix #80783: PDO ODBC truncates BLOB records at every 256th byte
 [2021-03-18 14:29 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2021-03-18 14:31 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=bccca0b53aa60a62e2988c750fc73c02d109e642
Log: Fix #80783: PDO ODBC truncates BLOB records at every 256th byte
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC