|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-06-14 19:24 UTC] discobean+pecl at gmail dot com
Description: ------------ I am using the Oracle OCI Driver that comes with PHP 5.2.1, compiled against the Oracle Instant Client for x86 Version 10.2.0.3. This WORKS (it var dumps 1 row) $query = 'select myblob from mytable where id in (445, 446)'; $stmt = $db->prepare($query); $stmt->execute(); $row = $stmt->fetch(); var_dump($row); This is BROKEN (it does not var_dump anything) $query = 'select myclob from mytable where id in (445, 446)'; $stmt = $db->prepare($query); $stmt->execute(); $row = $stmt->fetch(); var_dump($row); // I'm now fetching the second CLOB column, and it won't // var_dump anything $row = $stmt->fetch(); var_dump($row); Reproduce code: --------------- $query = 'select myclob from mytable where id in (445, 446)'; $stmt = $db->prepare($query); $stmt->execute(); $row = $stmt->fetch(); var_dump($row); // I'm now fetching the second CLOB column, and it won't // var_dump anything $row = $stmt->fetch(); var_dump($row); Expected result: ---------------- It should var_dump two rows. Actual result: -------------- It does not var_dump anything Patches57702-PHP-5.4-20120623.patch (last revision 2012-06-23 09:28 UTC by hswong3i at gmail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 01:00:01 2025 UTC |
I have fixed this bug. Move the line of code in oci_statement:oci_blob_close which free's the LOB locator to oci_stmt_dtor. Here is the correced code: static int oci_stmt_dtor(pdo_stmt_t *stmt TSRMLS_DC) /* {{{ */ ... .. if (S->cols) { for (i = 0; i < stmt->column_count; i++) { if (S->cols[i].data) { switch (S->cols[i].dtype) { case SQLT_BLOB: case SQLT_CLOB: OCIDescriptorFree(S->cols[i].data, OCI_DTYPE_LOB); break; default: efree(S->cols[i].data); } } } efree(S->cols); S->cols = NULL; } ... ... } /* }}} */ static int oci_blob_close(php_stream *stream, int close_handle TSRMLS_DC) { struct oci_lob_self *self = (struct oci_lob_self*)stream->abstract; pdo_stmt_t *stmt = self->stmt; if (close_handle) { OCILobClose(self->S->H->svc, self->S->err, self->lob); efree(self); } php_pdo_stmt_delref(stmt TSRMLS_CC); return 0; }