php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #55138 PDO_OCI cannot insert more than 1332 one byte chars in al32utf8 varchar2 field
Submitted: 2011-07-05 15:16 UTC Modified: 2014-01-01 12:43 UTC
Votes:11
Avg. Score:4.6 ± 1.1
Reproduced:11 of 11 (100.0%)
Same Version:4 (36.4%)
Same OS:6 (54.5%)
From: an0nym at narod dot ru Assigned:
Status: Open Package: PDO OCI
PHP Version: 5.3.6 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: an0nym at narod dot ru
New email:
PHP Version: OS:

 

 [2011-07-05 15:16 UTC] an0nym at narod dot ru
Description:
------------
PDO_OCI cannot insert more than 1332 one byte chars in al32utf8 varchar2(4000 
CHAR) field. 

Additional info
$ php -v
PHP 5.3.6 (cli) (built: Apr 27 2011 23:46:11)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
$ uname -a
Linux ... 2.6.18-194.32.1.el5 #1 SMP Wed Jan 5 17:52:25 EST 2011 x86_64 x86_64 
x86_64 GNU/Linux

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

Test script:
---------------
<?php
$DB = new PDO("oci:dbname=//host:port/dbname;charset=AL32UTF8", "...", "...",
              array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
foreach ($DB->query("SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET'") as $row)
    echo $row["VALUE"], "\n";
$DB->exec("CREATE TABLE test(test VARCHAR2(4000 CHAR))");
$statement = $DB->prepare("INSERT INTO test VALUES(:test)");
$test = str_repeat(chr(97), 1332);
$statement->bindParam(":test", $test);
$statement->execute();
$test .= chr(97);
try {
    $statement->execute();
} catch (PDOException $e) {
    $DB->exec("DROP TABLE test");
    exit("Error\n");
}
exit("Ok\n");


Expected result:
----------------
$ php test.php
AL32UTF8
Ok


Actual result:
--------------
$ php test.php
AL32UTF8
Error


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-07-05 15:26 UTC] an0nym at narod dot ru
This issue can be worked around by adding $statement->bindParam(":test", 
$test>>>, PDO::PARAM_STR, 4000<<<), however this does not fix the bug itself.
 [2012-10-01 18:08 UTC] dernelson at corelogic dot com
This issue also affects PDOStatement::bindValue(), which does not have the 4th parameter "length" like bindParam() does, so the workaround is not always possible.
 [2014-01-01 12:43 UTC] felipe@php.net
-Package: PDO related +Package: PDO OCI
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 24 02:01:28 2024 UTC