From:             
Operating system: Linux
PHP version:      5.3.2
Package:          PostgreSQL related
Bug Type:         Bug
Bug description:pg_copy_to: Invalid results when using fourth parameter

Description:
------------
When passing four arguments to pg_copy_to(), the resulting data is
corrupted.



My guess is that pg_null_as is being freed improperly. A similar pointer is
freed conditionally within pg_copy_from().



Could be related to segfault in bug 35168.

Test script:
---------------
// setup

pg_query($db, 'CREATE TEMP TABLE temp_test_table (a INT)');

pg_query($db, 'INSERT INTO temp_test_table VALUES (1)');



// success

var_dump(pg_copy_to($db, 'temp_test_table'));



// success

var_dump(pg_copy_to($db, 'temp_test_table', "\t"));



// failure

var_dump(pg_copy_to($db, 'temp_test_table', "\t", "\\\\N"));





Expected result:
----------------
Three identical arrays:



array(1) {

  [0]=>

  string(2) "1

"

}

array(1) {

  [0]=>

  string(2) "1

"

}

array(1) {

  [0]=>

  string(2) "1

"

}

Actual result:
--------------
The third array is corrupted:



array(1) {

  [0]=>

  string(2) "1

"

}

array(1) {

  [0]=>

  string(2) "1

"

}

array(1) {

  [0]=>

  string(2) "@�"

}

-- 
Edit bug report at http://bugs.php.net/bug.php?id=51609&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=51609&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=51609&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=51609&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=51609&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=51609&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=51609&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=51609&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=51609&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=51609&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=51609&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=51609&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=51609&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=51609&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=51609&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=51609&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=51609&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=51609&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=51609&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=51609&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=51609&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=51609&r=mysqlcfg

Reply via email to