Bug #57048 [Csd]: CLOB value is truncated

From: Date: Thu, 13 Oct 2016 16:13:46 +0000
Subject: Bug #57048 [Csd]: CLOB value is truncated
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-204671@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=57048&edit=1 ID: 57048 Updated by: ashnazg@php.net Reported by: vs at ez dot no Summary: CLOB value is truncated Status: Closed Type: Bug Package: *General Issues Operating System: Linux PHP Version: 4.4.1 Assigned To: ashnazg Block user comment: N Private report: N New Comment: (thought I was logging in, not assigning myself to this old bug... now it won't let me unassign it) Previous Comments: ------------------------------------------------------------------------ [2006-06-13 13:02:37] tony2001 at phpclub dot net The patch is already in CVS. ------------------------------------------------------------------------ [2006-06-13 07:00:46] vs at ez dot no Thank you. Looks like the patched version does not contain this bug. ------------------------------------------------------------------------ [2006-06-01 16:55:48] tony2001 at phpclub dot net Vadim, please try this patch: http://tony2001.phpclub.net/dev/tmp/oci8_callbacks.diff (optionally you can get patched oci8 here: http://tony2001.phpclub.net/dev/tmp/oci8.tar.gz) Hopefully this should fix all unicode lob problems. Thanks. ------------------------------------------------------------------------ [2006-05-29 09:51:29] vs at ez dot no In the reproduce code above, the value is inserted correctly, since "SELECT DBMS_LOB.GETLENGTH(lob) FROM clob_test" returns "500". So, the value gets truncated at time of fetching. ------------------------------------------------------------------------ [2006-05-29 09:36:34] vs at ez dot no Description: ------------ If I set the fourth parameter (charset) of function oci_connect() to 'UTF8' (=set client charset to Unicode) and then select a CLOB value from my table, the value gets truncated. Tried on two databases: 1. Oracle 9i (server charset is WE8ISO8859P1) 2. Oracle 10g XE (server charset is AL32UTF8) PHP 4.4.2 is linked against OIC-10.2.0.1 libraries. The bug is not reproducible with the standard PHP oci8 extension, but is with PECL/oci8. Reproduce code: --------------- <? // CREATE TABLE clob_test (lob CLOB); $origLobVal = str_repeat( 'x', 500 ); // randomly chosen character $conn = oci_connect( 'scott', 'tiger', 'orcl', 'UTF8' ); $stmt = oci_parse( $conn, 'DELETE FROM clob_test' ); oci_execute( $stmt, OCI_COMMIT_ON_SUCCESS ); $stmt = oci_parse( $conn, "INSERT INTO clob_test VALUES (EMPTY_CLOB()) RETURNING lob INTO :lob" ); $lob = oci_new_descriptor( $conn, OCI_D_LOB ); oci_bind_by_name( $stmt, ":lob", $lob, -1, OCI_B_CLOB ); oci_execute( $stmt, OCI_DEFAULT ); $lob->save( $origLobVal ); oci_commit( $conn ); $lob->free(); $stmt = oci_parse ( $conn, 'SELECT lob FROM clob_test' ); oci_execute( $stmt, OCI_DEFAULT ); $row = oci_fetch_array( $stmt, OCI_NUM ); $realLobVal = $row[0]->load(); printf( "original len: %d\nreal len: %d\n", strlen( $origLobVal ), strlen( $realLobVal ) ); oci_free_statement( $stmt ); ?> Expected result: ---------------- original len: 500 real len: 500 Actual result: -------------- original len: 500 real len: 166 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=57048&edit=1

« previous php.bugs (#204671) next »