php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35168 pg_copy_to SIGSEGV when 4th arg NULL
Submitted: 2005-11-09 11:17 UTC Modified: 2005-11-09 15:04 UTC
From: mdv at inyourpocket dot com Assigned:
Status: Closed Package: PostgreSQL related
PHP Version: 5.0.5 OS: Debian
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mdv at inyourpocket dot com
New email:
PHP Version: OS:

 

 [2005-11-09 11:17 UTC] mdv at inyourpocket dot com
Description:
------------
pg_copy_to($db, 'x', "\t", NULL) causes SIGSEGV

NULL should be default values ???

Reproduce code:
---------------
$db = pg_connect('host=localhost dbname=template1 user=postgres');

pg_copy_to($db, 'x', "\t", NULL);

Expected result:
----------------
should be rewrited to pg_copy_to($db, 'x', "\t", '\N');

read data from table

Actual result:
--------------
Starting program: /usr/local/php/bin/php -f x.php

Program received signal SIGSEGV, Segmentation fault.
0x08196665 in _efree (ptr=0x82b6564) at /root/src/php-5.0.5/Zend/zend_alloc.c:282
282             REMOVE_POINTER_FROM_LIST(p);
(gdb) bt
#0  0x08196665 in _efree (ptr=0x82b6564) at /root/src/php-5.0.5/Zend/zend_alloc.c:282
#1  0x080f4b42 in zif_pg_copy_to (ht=4, return_value=0x83c8e44, this_ptr=0x0, return_value_used=0) at /root/src/php-5.0.5/ext/pgsql/pgsql.c:2674
#2  0x081cad32 in zend_do_fcall_common_helper (execute_data=0xbfffd974, opline=0x83c325c, op_array=0x83bedc4) at /root/src/php-5.0.5/Zend/zend_execute.c:2760
#3  0x081d8c57 in zend_do_fcall_handler (execute_data=0xbfffd974, opline=0x83c325c, op_array=0x83bedc4) at /root/src/php-5.0.5/Zend/zend_execute.c:2894
#4  0x081c8662 in execute (op_array=0x83bedc4) at /root/src/php-5.0.5/Zend/zend_execute.c:1437
#5  0x081aab93 in zend_execute_scripts (type=8, retval=Variable "retval" is not available.
) at /root/src/php-5.0.5/Zend/zend.c:1064
#6  0x08175ecb in php_execute_script (primary_file=0xbffffd10) at /root/src/php-5.0.5/main/main.c:1643
#7  0x081df4aa in main (argc=3, argv=0xbffffdc4) at /root/src/php-5.0.5/sapi/cli/php_cli.c:946


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-09 11:41 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-11-09 13:18 UTC] mdv at inyourpocket dot com
tested and OK

but when suplied optional arguments (3rd - delimiter, 4th -  null_as) there aren't substitued to default values (delimiter = "\t", null_as = '\N') - is right behavior ?

thank you
 [2005-11-09 15:04 UTC] sniper@php.net
Yes, is right behaviour.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 03:01:26 2025 UTC