#36934 [NEW]: OCILob->read() doesn't move internal pointer when reading 0's
| From: | sswpwp at poczta dot onet dot pl | Date: | Fri, 31 Mar 2006 14:51:14 +0000 |
| Subject: | #36934 [NEW]: OCILob->read() doesn't move internal pointer when reading 0's | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-95167@lists.php.net to get a copy of this message | ||
From: sswpwp at poczta dot onet dot pl
Operating system: Windows 2000
PHP version: 5CVS-2006-03-31 (snap)
PHP Bug Type: OCI8 related
Bug description: OCILob->read() doesn't move internal pointer when reading 0's
Description:
------------
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");
oci_execute($stmt);
$row = oci_fetch_assoc($stmt);
$row['ZDJT_IMAGE']->read(128);
echo $row['ZDJT_IMAGE']->tell();
$row['ZDJT_IMAGE']->read(128);
echo $row['ZDJT_IMAGE']->tell();
$row['ZDJT_IMAGE']->seek(128);
echo $row['ZDJT_IMAGE']->tell();
$row['ZDJT_IMAGE']->read(128);
echo $row['ZDJT_IMAGE']->tell();
Expected result:
----------------
The expected result would be:
128
256
128
256
Actual result:
--------------
0
0
128
133
--
Edit bug report at http://bugs.php.net/?id=36934&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36934&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36934&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36934&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36934&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36934&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36934&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36934&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36934&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36934&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36934&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36934&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36934&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36934&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36934&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36934&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36934&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36934&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36934&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36934&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36934&r=mysqlcfg