1--TEST-- 2Bug GH-9411 (PgSQL large object resource is incorrectly closed) 3--EXTENSIONS-- 4pdo_pgsql 5--SKIPIF-- 6<?php 7require __DIR__ . '/config.inc'; 8require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 9PDOTest::skip(); 10?> 11--FILE-- 12<?php 13require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; 14$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); 15$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 16$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); 17 18$db->beginTransaction(); 19$oid = $db->pgsqlLOBCreate(); 20var_dump($lob = $db->pgsqlLOBOpen($oid, 'wb')); 21fwrite($lob, 'test'); 22$db->rollback(); 23var_dump($lob); 24 25$db->beginTransaction(); 26$oid = $db->pgsqlLOBCreate(); 27var_dump($lob = $db->pgsqlLOBOpen($oid, 'wb')); 28fwrite($lob, 'test'); 29$db->commit(); 30var_dump($lob); 31 32$db->beginTransaction(); 33var_dump($lob = $db->pgsqlLOBOpen($oid, 'wb')); 34var_dump(fgets($lob)); 35?> 36--EXPECTF-- 37resource(%d) of type (stream) 38resource(%d) of type (Unknown) 39resource(%d) of type (stream) 40resource(%d) of type (Unknown) 41resource(%d) of type (stream) 42string(4) "test" 43