xref: /PHP-7.3/ext/pgsql/tests/bug72197.phpt (revision b746e698)
1--TEST--
2Bug #72197 pg_lo_create arbitrary read
3--SKIPIF--
4<?php include("skipif.inc"); ?>
5--FILE--
6<?php
7/* This shouldn't crash. */
8$var1=-32768;
9$var2="12";
10pg_lo_create($var1, $var2);
11
12/* This should work correctly. */
13include('config.inc');
14
15/* Check with explicit link. */
16$conn = pg_connect($conn_str);
17pg_query($conn, "BEGIN");
18$oid = pg_lo_create($conn);
19var_dump($oid);
20
21/* Check with default link */
22$oid = pg_lo_create();
23var_dump($oid);
24
25/* don't commit */
26pg_query($conn, "ROLLBACK");
27pg_close($conn);
28?>
29==DONE==
30--EXPECTF--
31Warning: pg_lo_create(): supplied resource is not a valid PostgreSQL link resource in %sbug72197.php on line %d%w
32int(%d)
33int(%d)
34==DONE==
35