[php-src] Issue #9411: PgSQL large object resource is incorrectly closed
| From: | Yurunsoft | Date: | Wed, 24 Aug 2022 03:34:14 +0000 |
| Subject: | [php-src] Issue #9411: PgSQL large object resource is incorrectly closed | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242299@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9411
Author: Yurunsoft
### Description
The following code:
```php
<?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