|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 08:00:01 2025 UTC |
This issue can be worked around by adding $statement->bindParam(":test", $test>>>, PDO::PARAM_STR, 4000<<<), however this does not fix the bug itself.