php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57048 CLOB value is truncated
Submitted: 2006-05-29 09:36 UTC Modified: 2016-10-13 16:25 UTC
From: vs at ez dot no Assigned: nikic (profile)
Status: Closed Package: OCI8 related
PHP Version: 4.4.1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vs at ez dot no
New email:
PHP Version: OS:

 

 [2006-05-29 09:36 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-29 09:51 UTC] 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-06-01 16:55 UTC] 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-06-13 07:00 UTC] vs at ez dot no
Thank you. Looks like the patched version does not contain this bug.
 [2006-06-13 13:02 UTC] tony2001 at phpclub dot net
The patch is already in CVS.
 [2016-10-13 16:11 UTC] ashnazg@php.net
-Package: oci8 +Package: *General Issues -Assigned To: +Assigned To: ashnazg
 [2016-10-13 16:13 UTC] ashnazg@php.net
(thought I was logging in, not assigning myself to this old bug... now it won't let me unassign it)
 [2016-10-13 16:20 UTC] ashnazg@php.net
-Package: *General Issues +Package: OCI8 related
 [2016-10-13 16:20 UTC] ashnazg@php.net
(trying to set this back to OCI8, as well as unassign myself... but even though my password logs me in ok, it keeps saying "wrong password" when I try to edit this ticket)
 [2016-10-13 16:25 UTC] nikic@php.net
-Assigned To: ashnazg +Assigned To: nikic
 [2016-10-13 16:25 UTC] nikic@php.net
Looks like it's not possible to unassign in this state :)
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Oct 04 17:03:58 2022 UTC