xref: /PHP-7.1/ext/pgsql/tests/bug65119.phpt (revision f8a8ccab)
1--TEST--
2Bug #65119 (pg_copy_from() modifies input array variable)
3--SKIPIF--
4<?php
5include("skipif.inc");
6?>
7--FILE--
8<?php
9include 'config.inc';
10
11function test(Array $values, $conn_str) {
12  $connection = pg_pconnect($conn_str, PGSQL_CONNECT_FORCE_NEW);
13  pg_query("begin");
14  pg_query("CREATE TABLE bug65119 (i INTEGER)");
15  pg_copy_from($connection, "bug65119", $values, "\t", "NULL");
16  pg_query("rollback");
17}
18
19$values = Array(1,2,3);
20var_dump($values);
21test($values, $conn_str);
22var_dump($values);
23?>
24--EXPECT--
25array(3) {
26  [0]=>
27  int(1)
28  [1]=>
29  int(2)
30  [2]=>
31  int(3)
32}
33array(3) {
34  [0]=>
35  int(1)
36  [1]=>
37  int(2)
38  [2]=>
39  int(3)
40}
41