php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37406 Can't load lob string
Submitted: 2006-05-11 10:57 UTC Modified: 2006-06-02 09:16 UTC
Votes:7
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:1 (33.3%)
From: spatar at mail dot nnov dot ru Assigned:
Status: Closed Package: OCI8 related
PHP Version: 5.1.4 OS: SuSE
Private report: No CVE-ID: None
 [2006-05-11 10:57 UTC] spatar at mail dot nnov dot ru
Description:
------------
Can't load lob string.
It seems, OCI8 calculates wrong size in _bytes_ for UTF strings to load.
My Oracle database charset is AL32UTF8, so maybe it's the cause of that the load() method returns only the first 1/4 part of a string.
The older versions didn't have this bug.

Reproduce code:
---------------
<?php
        $conn = oci_connect("scott", "tiger", "ora10201");
        $sql =  "begin :p_clob := 'abcdefghijklmnopqrstuvwxyz'; end;";
        $stid = oci_parse($conn, $sql);
        $clob = oci_new_descriptor($conn, OCI_D_LOB);
        oci_bind_by_name($stid, ":p_clob", $clob, -1, OCI_B_CLOB);
        $r = oci_execute($stid, OCI_DEFAULT);
        if ($r)
        {
                echo "size(): ", $clob->size(), "\n";
                echo "load(): ", $clob->load(), "\n";
        }
        $clob->free();
        oci_free_statement($stid);
        oci_close($conn);
?>

Expected result:
----------------
size(): 26
load(): abcdefghijklmnopqrstuvwxyz

Actual result:
--------------
size(): 26
load(): abcdef

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-11 11:09 UTC] spatar at mail dot nnov dot ru
In older snapshot php5.1-200604030830 it worked:
----------------
size(): 26
load(): abcdefghijklmnopqrstuvwxyz
 [2006-05-12 13:55 UTC] matuszynski at element5 dot de
I encountered a similar problem that might be related to this one: Reading CLOBs always leads to empty strings.

When running the given sample, I get the following output:

size(): 26
load():

We're using Oracle 10 client and PHP 5.1.4 under Ubuntu and connect to a Oracle 9i DB running under Solaris on SPARC
 [2006-05-15 09:07 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

Please try next snapshot.
 [2006-05-15 10:17 UTC] spatar at mail dot nnov dot ru
The latest CVS snapshot (php5.2-200605150830) produces the same wrong result:
----------------
size(): 26
load(): abcdef
 [2006-05-15 10:31 UTC] tony2001@php.net
I intentionally wrote "next snapshot" because the latest snapshot was built BEFORE the patch has been applied.
 [2006-05-15 12:19 UTC] spatar at mail dot nnov dot ru
Sorry.
Now I tested with snapshot php5.2-200605151030 and result is still the same :(
 [2006-05-15 13:56 UTC] tony2001@php.net
I'd appreciate if you provide an account for me to reproduce & investigate this problem on your server.
 [2006-05-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-06-02 09:16 UTC] spatar at mail dot nnov dot ru
With the latest changes problem seems to be fixed.
Thanks!
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Aug 05 14:01:24 2021 UTC