Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Fix PDO_OCI UTF-8 output truncated #7

wants to merge 1 commit into from

5 participants

Lucas Souza Tomasz Sawicki David Soria Parra Philippe Villiers
Lucas Souza

Fix annoying "column 0 data was too large for buffer and was truncated to fit it" message with utf-8 in pdo_oci

cjbj commented on e8a1fea

Needs a test case

create table t(c1 char(1));
insert into t values('ç');
$pdo = new PDO('oci:dbname=localhost/xe;charset=AL32UTF8', 'user', 'pass');
$stmt = $pdo->query('select * from t');
$data = $stmt->fetch(PDO::FETCH_ASSOC);

// Expected array('C1' => 'ç')
// Found Warning: PDOStatement::fetch(): column 0 data was too large for buffer and was truncated to fit it
// array('C1' => '')
cjbj commented

A working .phpt would really help speed up the process

Tomasz Sawicki

Looking forward to fix this issue, because it basically makes pdo_oci unusable when working with UTF8 encoding.

David Soria Parra
dsp commented

@cjbj Do we have a Bug ID for that?

I think it might be good to have the pull request for the PHP-5.3 branch. This gives us the flexebility to decide into which branch we have to pull it without the need of manual cherry picking

cjbj commented

@lucassouza1 please log a bug if there isn't one open.

@lucassouza1 @Furgas If this is important to you, please create a .phpt testcase. PDO_OCI doesn't have a maintainer, so any pull request needs to be super easy for a 3rd party to evaluate.

Finally use OCI8 because PDO_OCI suffers scaling problems due to the lack of statement caching and connection pooling that are available in OCI8.

David Soria Parra
dsp commented

any update on this?

Philippe Villiers

I added a test in pull request 59 (#59 - sorry didn't see there was already a pull request for this bug)

Lucas Souza

No problem, a test should be done and you did it, I'll close this one

Clint Priest cpriest referenced this pull request in cpriest/php-src

Accessors: SIGSEGV on basic usage #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 20, 2012
Lucas Souza lucassouza1 Fix PDO_OCI UTF-8 output truncated e8a1fea
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 2 ext/pdo_oci/oci_statement.c
4 ext/pdo_oci/oci_statement.c
@@ -528,8 +528,8 @@ static int oci_stmt_describe(pdo_stmt_t *stmt, int colno TSRMLS_DC) /* {{{ */
529 529 (param, OCI_DTYPE_PARAM, &colname, &namelen, OCI_ATTR_NAME, S->err));
530 530
531   - col->precision = scale;
532   - col->maxlen = data_size;
  531 + col->precision = scale;
  532 + col->maxlen = ( data_size + 1 ) * sizeof(utext);
533 533 col->namelen = namelen;
534 534 col->name = estrndup((char *)colname, namelen);
535 535

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.