From: milanm at datax dot biz
Operating system: Linux
PHP version: 5.1.2
PHP Bug Type: PDO related
Bug description: Problem loading BLOB over 1MB
Description:
------------
I got a table and a stored 1.5 MB image in it. But when i try to load it
into variable using PDO it has only 1MB. I'm using pdo_mysql client
library 5.0.18.
Reproduce code:
---------------
<?php
error_reporting(E_ALL);
$dsn = 'mysql:host=10.0.0.102;port=3306;dbname=test;';
$user = 'user';
$password = 'pass';
$mysql_pdo = new PDO($dsn, $user, $password);
$blob_id = 1;
$stmt = $mysql_pdo->prepare('SELECT data FROM test WHERE id=:id');
$stmt->bindParam(':id', $blob_id, PDO::PARAM_INT);
$mysql_pdo->beginTransaction();
$stmt->execute();
$mysql_pdo->commit();
$stmt->bindColumn(1, $blob_fp, PDO::PARAM_LOB);
$stmt->fetchAll(PDO::FETCH_BOUND);
header('Content-Type: image/jpeg');
print $blob_fp;
?>
Table looks like this:
CREATE TABLE test (
id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(10) NOT NULL,
data LONGBLOB NOT NULL,
PRIMARY KEY id (id),
UNIQUE KEY name (name)
) type=InnoDB;
--
Edit bug report at http://bugs.php.net/?id=36345&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36345&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36345&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36345&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36345&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36345&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36345&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36345&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36345&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36345&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36345&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36345&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36345&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36345&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36345&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36345&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36345&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36345&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36345&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36345&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36345&r=mysqlcfg