Bug->Doc #70700 [NoF->Opn]: LOB read loop ends early for multibyte strings

From: Date: Wed, 25 Jan 2017 00:05:06 +0000
Subject: Bug->Doc #70700 [NoF->Opn]: LOB read loop ends early for multibyte strings
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14369@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70700&edit=1 ID: 70700 Updated by: sixd@php.net Reported by: ashnazg@php.net Summary: LOB read loop ends early for multibyte strings -Status: No Feedback +Status: Open -Type: Bug +Type: Documentation Problem Package: OCI8 related Operating System: RHEL6, Win7 PHP Version: 5.5.30 Assigned To: sixd Block user comment: N Private report: N New Comment: This is a doc bug. The following comments from a github account-less developer are regarding the testcase in https://github.com/php/php-src/pull/1569 "Thank you for reporting this issue and providing a PR. The reason why lob->read() stops at the first loop is because it returns all of data within one loop. lob->read(length) reads length of bytes from BLOB and length of characters from CLOB. So in #1560 test, when lob->read(8192) is called to read multibyte string from a CLOB column, and it actually reads 8192 characters so that the total data (4100 characters) is read in one chunk. However, only 8192 bytes are written into the file that's why only 8192 bytes gets printed later: fwrite($fh, $data, 8192); So to make this test behave as expected, we need to replace all the appearances of above line to: fwrite($fh, $data, strlen($data)); // write all of data in $data to the file For more info about OCI Lob read, please refer to (1) OCILobRead2 doc (http://docs.oracle.com/database/122/LNOCI/lob-functions.htm#LNOCI17214) (2) OCI8 driver code for lob reading (http://lxr.php.net/xref/PHP-MASTER/ext/oci8/oci8_lob.c#326). Hence, it's not a code bug but the behavior of Lob read is not documented properly. We will update the doc." Previous Comments: ------------------------------------------------------------------------ [2015-11-15 04:22:14] php-bugs at lists dot php dot net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. ------------------------------------------------------------------------ [2015-11-02 18:15:13] sixd@php.net If you are using multibyte characters you will almost certainly want NLS_LANG set. It is just an environment variable, so you can 'echo' it, and/or check phpinfo(), or run php -i, Review http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html ------------------------------------------------------------------------ [2015-10-29 15:36:55] ashnazg@php.net The bugtracker will not allow me to change the status to ReOpened. I am indeed still having this problem. In my last comment, I asked for a way to determine the answer to your question about "client NLS_LANG". Is running the PHPT test I provided not an option to see if you can duplicate the issue? ------------------------------------------------------------------------ [2015-10-25 04:22:30] php-bugs at lists dot php dot net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. ------------------------------------------------------------------------ [2015-10-14 21:42:05] ashnazg@php.net I can't seem to google a way to determine client NLS_LANG... The only examples I see are from in sqlplus: SQL> ! $ echo $NLS_LANG but that returns nothing. Perhaps that means my client is not setting it? (also, that's good to know that OCI8 doesn't cover N-stuff either... was only aware of PDO OCI not handling it) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=70700 -- Edit this bug report at https://bugs.php.net/bug.php?id=70700&edit=1

« previous php.doc.bugs (#14369) next »