PHP 4.0 Bug #6601: blobs retrieved from database are limited to 32768 nibbles
| From: | koos at kzdoos dot xs4all dot nl | Date: | Thu, 07 Sep 2000 13:23:16 +0000 |
| Subject: | PHP 4.0 Bug #6601: blobs retrieved from database are limited to 32768 nibbles | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-32545@lists.php.net to get a copy of this message | ||
From: koos@kzdoos.xs4all.nl
Operating system: Linux 2.2.17, redhat 6.2, sybase 11.0.3.3
PHP version: 4.0.2
PHP Bug Type: Sybase-ct (ctlib) related
Bug description: blobs retrieved from database are limited to 32768 nibbles
I store blobs in sybase IMAGE fields and when I retrieve them I only get the first 32768 nibbles and
nothing more.
I store them using:
$fp=fopen($userfile,'r');
$blob=bin2hex(fread($fp,filesize($userfile)));
$qid=sybase_query("
INSERT INTO blob(blobtype_id,title,body)
VALUES ($mimetypeid,'$blobtitle',0x".$blob.")");
and retrieve them using
$qid=sybase_query("
SELECT blobtype.mimetype,blob.body
FROM blob,blobtype
WHERE blob.blob_id=$blobobjectid
AND blob.blobtype_id=blobtype.blobtype_id",$conid);
if ($qid){
list($blobtype_mimetype,$blob_body)=sybase_fetch_row($qid);
header("Content-Type: $blobtype_mimetype");
$bloblen=strlen($blob_body);
echo pack("H".$bloblen,$blob_body);
}
using debug statements I found that $bloblen is never more then 32768, and the database contains
bigger datalength's.
32768 is a round number so I guess I ran into some buffer size. What to do and how to get the bigger
blobs.
PHP 4.0.2, apache 3.0.12
./configure --with-mysql --with-sybase-ct=/opt/sybase --with-apache=../apache_1.3.12
--enable-track-vars