From:
Operating system: OEL 5 / RHEL5 / Win7
PHP version: Irrelevant
Package: PDO related
Bug Type: Bug
Bug description:PDO_OCI: Reading a multibyte CLOB caps at 8192 characters
Description:
------------
Inserting large multibyte strings works fine,
reading them back in results in only 8192 characters read (=24576 bytes).
Even if inserting mixed single-multibyte strings, reading caps at 8192
characters (even though the byte count is far less).
Inserting and reading 100000 single bytes work, though.
Attached a file with more debug output.
== PHP ==
We are using ZendServer 5.5.0:
PHP 5.3.8-ZS5.5.0 (cli) (built: Aug 23 2011 05:20:27)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
But this bug also is on PHP 5.4.0RC8-dev
== Oracle ==
Oracle XE 10.2.0.1, but also on Enterprise 10.2.0.4.0.
Characterset: AL32UTF8
Test table:
create table TEST_LOB (
tl_id NUMBER(3),
tl_byte_16 VARCHAR2(16 BYTE),
tl_char_16 VARCHAR2(16 CHAR),
tl_byte_4000 VARCHAR2(4000 BYTE),
tl_char_4000 VARCHAR2(4000 CHAR),
tl_blob BLOB,
tl_clob CLOB,
tl_date DATE,
tl_number NUMBER
)
Test script:
---------------
$dsn = 'oci:dbname=(DESCRIPTION=(ADDRESS_LIST=(
ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
(CONNECT_DATA=(SID=xe)));charset=AL32UTF8';
$username = 'USER';
$password = 'PW';
$lobTestTablename = 'TEST_LOB';
$id = -1;
$clobData = str_repeat('â¦', 8193);
$pdo = new PDO($dsn, $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$pdo->exec("delete from $lobTestTablename where tl_id < 0");
$pdoStmt = $pdo->prepare("insert into $lobTestTablename (tl_id, tl_clob)
values (?, ?)");
$pdoStmt->bindParam(1, $id, PDO::PARAM_INT, null, null);
$pdoStmt->bindParam(2, $clobData, PDO::PARAM_STR, strlen($clobData),
null);
$pdoStmt->execute();
$pdoStmt = $pdo->query("select * from $lobTestTablename where TL_ID =
$id");
$row = $pdoStmt->fetch(PDO::FETCH_ASSOC);
$dataRead = stream_get_contents($row['TL_CLOB']);
printf("values equal: %s\n", var_export($clobData === $dataRead, true));
Expected result:
----------------
values equal: false
Actual result:
--------------
values equal: true
--
Edit bug report at https://bugs.php.net/bug.php?id=60994&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60994&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60994&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60994&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60994&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60994&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60994&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60994&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60994&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60994&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60994&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60994&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60994&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60994&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60994&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60994&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60994&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60994&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60994&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60994&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60994&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60994&r=mysqlcfg