Skip to content

PgSQL large object resource is incorrectly closed #9411

Closed

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

Activity

  1. cmb69 commented on Aug 24, 2022

    @cmb69
    Member

    Indeed, the first LOB stream is only closed after the second transaction has been started.

  2. added 2 commits that reference this issue on Sep 5, 2022
    6ac3f7c
    b5cad50
  3. added 2 commits that reference this issue on Sep 5, 2022
    15405c6
    669312d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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