Skip to content

PgSQL large object resource is incorrectly closed #9411

Closed
@Yurunsoft

Description

@Yurunsoft

Description

The following code:

<?php
$pdo = new PDO('pgsql:host=127.0.0.1;dbname=test', 'root', 'root');
$pdo->beginTransaction();
$oid = $pdo->pgsqlLOBCreate();
var_dump($lob = $pdo->pgsqlLOBOpen($oid, 'wb'));
fwrite($lob, 'test');
$pdo->commit();
$pdo->beginTransaction();
var_dump($lob = $pdo->pgsqlLOBOpen($oid, 'wb'));
var_dump(fgets($lob));

Resulted in this output:

resource(4) of type (stream)
resource(5) of type (stream)
bool(false)

But I expected this output instead:

resource(4) of type (stream)
resource(5) of type (stream)
string(4) "test"

PHP Version

PHP 8.0.21

Operating System

Ubuntu 20.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions