|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71291 Blob files are corrupted when insert on a 64bit OS.
Submitted: 2016-01-05 18:30 UTC Modified: 2017-09-30 17:51 UTC
From: josemalonsom at yahoo dot es Assigned:
Status: Closed Package: PDO_INFORMIX (PECL)
PHP Version: Irrelevant OS: Ubuntu 15.10 x86_64
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: josemalonsom at yahoo dot es
New email:
PHP Version: OS:


 [2016-01-05 18:30 UTC] josemalonsom at yahoo dot es
When a binary file is inserted in a blob field the content is saved partially corrupting the file. Tested in a 32bit OS and it works fine but the file is not saved correctly when the platform is 64bit.

PHP: tested in versions 5.4.45, 5.5.30 and 5.6.16.
CSDK: 4.10.FC6DE

Test script:
// $con is a valid PDO_INFORMIX connection


$blobFile = '/tmp/';

file_put_contents($blobFile, base64_decode($base64BlobFile));

try {
    $con->exec('DROP TABLE blob_test');
catch (Exception $e) {}

$con->exec('CREATE TABLE blob_test (blob_column BLOB)');

$fh = fopen($blobFile, 'rb');

$stmt = $con->prepare('INSERT INTO blob_test (blob_column) VALUES (?)');
$stmt->bindParam(1, $fh, PDO::PARAM_LOB);

$stmt = $con->prepare('SELECT FIRST 1 blob_column FROM blob_test');
$stmt->bindColumn(1, $blob, PDO::PARAM_LOB);

fseek($fh, 0);
$expectedContent = stream_get_contents($fh);
$actualContent = stream_get_contents($blob);

print $expectedContent == $actualContent ? "Test ok\n" : "Test fail\n";

Expected result:
The file should be inserted correctly.

Actual result:
The inserted file is corrupted.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-28 08:33 UTC] javier dot sagrera at uk dot ibm dot com
This is not a PDO_INFORMIX bug. It was caused by a defect within the ODBC driver (idsdb00512869).
The upcoming CSDK 4.10.xC9 version solves this problem.
 [2017-09-30 17:51 UTC] josemalonsom at yahoo dot es
-Status: Open +Status: Closed
 [2017-09-30 17:51 UTC] josemalonsom at yahoo dot es
I was waiting to test it with the CSDK 4.10.xC9 you mentioned before closing the bug. I have just doing it and I can confirm that solves the problem.

Thank you very much.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 10:01:29 2024 UTC