|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36934 OCILob->read() doesn't move internal pointer when reading 0's
Submitted: 2006-03-31 16:51 UTC Modified: 2006-04-05 14:09 UTC
From: sswpwp at poczta dot onet dot pl Assigned: tony2001
Status: Closed Package: OCI8 related
PHP Version: 5CVS-2006-03-31 (snap) OS: Windows 2000
Private report: No CVE-ID:
 [2006-03-31 16:51 UTC] sswpwp at poczta dot onet dot pl
When using OCILob->read(length) function with BLOBs containing 0's it reads specified amount of bytes but doesn't move internal pointer properly. The pointer is moved to the next '0' byte and no further. 
I think the possible cause of this bug is line 223 in oci8_lob.c file:
data_len_chars = OCIMultiByteStrnDisplayLength(connection->env, *data, bytes_total); 

Propably the function quits after reaching '\0' character instead of checking bytes_total bytes and as such should be used only with CLOBs.

Reproduce code:
First 128 bytes in the BLOB I'm reading are 0's, then there are 5 non-zero bytes followed by some more 0's.

$stmt = oci_parse($auth->conn, "SELECT ZDJT_IMAGE FROM IMAGES WHERE IMAGE_ID = 1");
$row = oci_fetch_assoc($stmt);

echo $row['ZDJT_IMAGE']->tell();
echo $row['ZDJT_IMAGE']->tell();

echo $row['ZDJT_IMAGE']->tell();
echo $row['ZDJT_IMAGE']->tell();

Expected result:
The expected result would be:


Actual result:



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-31 17:02 UTC] sswpwp at poczta dot onet dot pl
I'm using Apache 2.0.55 and Oracle Instant Client 10.2.0
 [2006-04-05 14:09 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

 [2014-06-01 13:11 UTC]
Automatic comment from SVN on behalf of salathe
Log: Comment improvements

Patch by anonymous #36934
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 23:01:31 2015 UTC