From: thuejk at gmail dot com Operating system: Linux (all?) PHP version: 5.5.0 Package: PostgreSQL related Bug Type: Bug Bug description:pg_copy_from() modifies input array variable
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 bug report at https://bugs.php.net/bug.php?id=65199&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65199&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65199&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65199&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=65199&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=65199&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=65199&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=65199&r=needscript Try newer version: https://bugs.php.net/fix.php?id=65199&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=65199&r=support Expected behavior: https://bugs.php.net/fix.php?id=65199&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=65199&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=65199&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=65199&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65199&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=65199&r=dst IIS Stability: https://bugs.php.net/fix.php?id=65199&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=65199&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=65199&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=65199&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=65199&r=mysqlcfg