xref: /PHP-8.3/ext/pgsql/tests/gh10672.phpt (revision 5f357f34)
1--TEST--
2GH-10672 (pg_lo_open segfaults in the strict_types mode)
3--EXTENSIONS--
4pgsql
5--SKIPIF--
6<?php
7include("skipif.inc");
8?>
9--FILE--
10<?php
11declare(strict_types=1);
12
13include "config.inc";
14
15$db = pg_connect($conn_str);
16pg_query($db, "DROP TABLE IF EXISTS gh10672");
17pg_query($db, "CREATE TABLE gh10672 (bar text);");
18
19// Begin a transaction
20pg_query($db, 'BEGIN');
21
22// Create an empty large object
23$oid = pg_lo_create($db);
24
25if ($oid === false) {
26    die(pg_last_error($db));
27}
28
29// Open the large object for writing
30$lob = pg_lo_open($db, $oid, 'w');
31
32if ($oid === false) {
33    die(pg_last_error($db));
34}
35
36echo 'The large object has been opened successfully.', PHP_EOL;
37?>
38--EXPECT--
39The large object has been opened successfully.
40