php-src/ext/pgsql/tests/bug65119.phpt
KentarouTakeda c15988aab3
ext/pgsql: Refactor tests (#12608)
This makes the tests independent of each other and allows them to be run in parallel.

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2023-11-06 22:36:52 +00:00

45 lines
774 B
PHP

--TEST--
Bug #65119 (pg_copy_from() modifies input array variable)
--EXTENSIONS--
pgsql
--SKIPIF--
<?php
include("inc/skipif.inc");
?>
--FILE--
<?php
include 'inc/config.inc';
$table_name = 'table_bug65119';
function test(Array $values, $conn_str) {
global $table_name;
$connection = pg_pconnect($conn_str, PGSQL_CONNECT_FORCE_NEW);
pg_query($connection, "BEGIN");
pg_query($connection, "CREATE TABLE {$table_name} (i INTEGER)");
pg_copy_from($connection, $table_name, $values, "\t", "NULL");
pg_query($connection, "ROLLBACK");
}
$values = Array(1,2,3);
var_dump($values);
test($values, $conn_str);
var_dump($values);
?>
--EXPECT--
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}