Skip to content

Fix bug #55138 PDO OCI cannot insert more than 1332 bytes #633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions ext/pdo_oci/oci_statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,8 @@ static int oci_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *pa
case PDO_PARAM_STR:
default:
P->oci_type = SQLT_CHR;
value_sz = param->max_value_len;
if (param->max_value_len == 0) {
value_sz = 1332; /* maximum size before value is interpreted as a LONG value */
}

/* we can provide as much data as value_sz can fit */
value_sz = SB4MAXVAL;
}

if (param->name) {
Expand Down
27 changes: 27 additions & 0 deletions ext/pdo_oci/tests/bug55138.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--TEST--
PDO OCI Bug #55138 (cannot insert more than 1332 one byte chars in al32utf8 varchar2 field)
--SKIPIF--
<?php
/* $Id$ */
if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not loaded');
require dirname(__FILE__).'/../../pdo/tests/pdo_test.inc';
PDOTest::skip();
?>
--FILE--
<?php
require 'ext/pdo/tests/pdo_test.inc';
$db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt');

$db->exec("CREATE TABLE test(test VARCHAR2(2000))");
$statement = $db->prepare("INSERT INTO test VALUES(:test)");
$test = str_repeat("F", 2000);
$statement->bindParam(":test", $test);
$result = $statement->execute();
var_dump($result);

$data = $db->query('SELECT * FROM test')->fetchAll();
$result = ($test === $data[0][0]);
var_dump($result);
--EXPECTF--
bool(true)
bool(true)