Bug #65199 [Asn->Csd]: pg_copy_from() modifies input array variable

From: Date: Thu, 28 Nov 2013 16:34:15 +0000
Subject: Bug #65199 [Asn->Csd]: pg_copy_from() modifies input array variable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182992@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65199&edit=1 ID: 65199 Updated by: derick@php.net Reported by: thuejk at gmail dot com Summary: pg_copy_from() modifies input array variable -Status: Assigned +Status: Closed Type: Bug Package: PostgreSQL related Operating System: Linux (all?) PHP Version: 5.5.0 Assigned To: yohgaki Block user comment: N Private report: N New Comment: Automatic comment on behalf of github@derickrethans.nl Revision: http://git.php.net/?p=php-src.git;a=commit;h=d22cc5c816fdb6017ce9e22b4594d1566939e4ec Log: Fixed bug #65199 (Wrong Day of Week) and fixed bug #63391 (Incorrect/inconsistent day of week prior to the year 1600) Previous Comments: ------------------------------------------------------------------------ [2013-10-03 20:27:28] yohgaki@php.net Ok, I will ------------------------------------------------------------------------ [2013-10-02 07:40:29] mike@php.net Yasuo, can you have a look, please? Probably just a separation issue. ------------------------------------------------------------------------ [2013-07-03 23:04:57] thuejk at gmail dot com Description: ------------ The variable holding the array of values I pass to pg_copy_from() is modified by pg_copy_from() (ints are changed to strings). Even though there is no pass-by- reference involved. This bug also exists in PHP 5.2 at least. Test script: --------------- <?php function test(Array $values) { $params = sprintf("host='%s' dbname='%s' user='%s' password='%s'", "localhost", "thue", "thue", "password"); $connection = pg_pconnect($params, PGSQL_CONNECT_FORCE_NEW); pg_query("begin"); pg_query("CREATE TABLE test(i INTEGER)"); pg_copy_from($connection, "test", $values, "\t", "NULL"); pg_query("rollback"); } $values = Array(1,2,3); var_dump($values); test($values); var_dump($values); ?> Expected result: ---------------- The two var_dump()s should return identical outputs. Actual result: -------------- t@t ~/php/php-5.5.0> ./sapi/cli/php ~/test.php array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } array(3) { [0]=> string(1) "1" [1]=> string(1) "2" [2]=> string(1) "3" } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65199&edit=1

« previous php.bugs (#182992) next »