Edit report at https://bugs.php.net/bug.php?id=57702&edit=1

 ID:                 57702
 Updated by:         larue...@php.net
 Reported by:        discobean+pecl at gmail dot com
 Summary:            Multiple BLOB fetch fails
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            PDO related
 Operating System:   Linux 2.6.20-15
 PHP Version:        5.2.1
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of laruence
Revision: 
http://git.php.net/?p=php-src.git;a=commit;h=4fcf4e084508ae18dddc02891f7c6fb10e49447e
Log: Fixed bug #57702 (Multi-row BLOB fetches)


Previous Comments:
------------------------------------------------------------------------
[2012-06-24 13:06:04] hswong3i at gmail dot com

Sorry for using legacy patch contribute style... Renew as pull request at 
Github:
* https://github.com/php/php-src/pull/118

------------------------------------------------------------------------
[2012-06-23 09:33:21] hswong3i at gmail dot com

When developing Drupal 7.x pdo_oci driver (https://github.com/hswong3i/oci) I 
face this bug too.

Once review with latest patch + cleanup + combo patch with 
https://bugs.php.net/patch-display.php?bug_id=52958&patch=52958-PHP-5.4-20120623.patch&revision=latest,
 the segfault no longer exists on 5.4.5-dev (20120623) + Ubuntu 12.04.

may someone apply this patch and get it fixed?

------------------------------------------------------------------------
[2012-03-23 16:44:37] s dot guilford at dbplugins dot com

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;
}

------------------------------------------------------------------------
[2007-06-14 19:24:20] 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


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=57702&edit=1

Reply via email to