Bug #70700 [NEW]: LOB read loop ends early for multibyte strings

From: Date: Mon, 12 Oct 2015 19:29:37 +0000
Subject: Bug #70700 [NEW]: LOB read loop ends early for multibyte strings
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196562@lists.php.net to get a copy of this message
From:             ashnazg
Operating system: RHEL6, Win7
PHP version:      5.5.30
Package:          OCI8 related
Bug Type:         Bug
Bug description:LOB read loop ends early for multibyte strings

Description:
------------
When using the "while !$lob->eof() { $lob->read($chunk); fwrite($chunk)
}" loop to read the contents of a long CLOB that contains only
single-byte characters, everything works fine (can get a 10,000,000 char
clob no problem).

However, if the CLOB contains mutibyte characters, it seems as though
the size of the first LOB->read() call is as far as the loop will go. 
Thus, reading the LOB in chunks does not succeed, though no errors are
given.

A workaround is to use LOB->size() to determine the full size of the
CLOB, and then do one LOB->read() on a larger size chunk (thus getting
the entire CLOB in one single, huge read).  I have to guess this is hard
on memory usage when large CLOBs are in play, and is thus not a
desirable workaround.

Test script:
---------------
(will provide a PHPT in a PR)


-- 
Edit bug report at https://bugs.php.net/bug.php?id=70700&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=70700&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=70700&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=70700&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=70700&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=70700&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=70700&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=70700&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=70700&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=70700&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=70700&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=70700&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=70700&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=70700&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70700&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=70700&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=70700&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=70700&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70700&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=70700&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=70700&r=mysqlcfg



Thread (11 messages)

« previous php.bugs (#196562) next »