php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56655 Blobs read with ocifetchinto have maximum size of 1048576 bytes
Submitted: 2005-11-17 06:08 UTC Modified: 2006-03-21 10:07 UTC
From: dziugas dot baltrunas at metasite dot net Assigned: tony2001 (profile)
Status: Closed Package: oci8 (PECL)
PHP Version: 4.3.10 OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dziugas dot baltrunas at metasite dot net
New email:
PHP Version: OS:

 

 [2005-11-17 06:08 UTC] dziugas dot baltrunas at metasite dot net
Description:
------------
Reading a BLOB column which is bigger than 1048576 bytes (this number is defined as PHP_OCI_LOB_BUFFER_SIZE in php_oci8_int.h) with ocifetchinto function with mode OCI_RETURN_LOBS, returned blob column always have a size of 1048576.

This is definitely a bug in oci8_lob.c:php_oci_lob_get_length() function (as php_oci_lob_read is called from oci8_interface.c with read_length =-1) or in a reading loop in oci8_lob.c:php_oci_lob_read function.

Reproduce code:
---------------
$data = array();
$conn = OCIPLogon("user", "pass", "db");
$query = "SELECT BLOB_COLUMN FROM t WHERE ID=:id";

$cur = OCIParse($conn, $query);
OCIBindByName ($cur, ':id', $id, 4000);
$er = OCIExecute($cur);
if (!$er) print_r(OCIError($cur));
OCIFetchInto($cur, $data, OCI_ASSOC + OCI_RETURN_NULLS + OCI_RETURN_LOBS);
OCIFreeStatement($cur);

echo strlen($data['BLOB_COLUMN']);

Expected result:
----------------
Returned length of $data['BLOB_COLUMN'] should be the original length of the BLOB_COLUMN in table t.

Actual result:
--------------
Returned length of $data['BLOB_COLUMN'] is always 1048576 bytes.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-17 06:19 UTC] tony2001 at phpclub dot net
Please try latest OCI8 from PECL CVS.
 [2005-11-18 03:50 UTC] dziugas dot baltrunas at metasite dot net
Looks like the same is achieved with CVS version as well. Here is a snip from phpinfo():

OCI8 Support 	enabled
Revision 	$Revision: 1.280 $

dziugas@office:~/work/dziugas/tmp$ wget http://url/file
--10:44:40--  http://url/file
           => `file'
Resolving url... done.
Connecting to xxx[yyy]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,364,535 [application/pdf]

76% [=======================================================================================>                           ] 1,048,576    125.20K/s    ETA 00:02

10:44:55 (125.20 KB/s) - Connection closed at byte 1048576. Retrying.

The script returning the contents from the database is similar to one I wrote earlier.
 [2006-03-21 10:07 UTC] tony2001 at phpclub dot net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 10:01:29 2024 UTC