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