#47048 [Com]: Segfault with new pg_meta_data
ID: 47048 Comment by: webs dot support at gmail dot com Reported By: ml-php dot net at bettercom dot de Status: Feedback Bug Type: PostgreSQL related Operating System: FreeBSD 7.0-RELEASE PHP Version: 5.2.8 New Comment: Felipe, check your code for the operating system FreeBSD 7.0 and you catch a bug. Previous Comments: [2009-01-17 22:56:08] fel...@php.net It works fine for me, see: teste=# SELECT table_schema, table_name FROM information_schema.tables WHERE table_schema = 'public'; table_schema | table_name --+ public | id var_dump(pg_meta_data($x, 'id')); array(1) { ["id"]=> array(6) { ["num"]=> int(1) ["type"]=> string(4) "int4" ["len"]=> int(4) ["not null"]=> bool(false) ["has default"]=> bool(false) ["array dims"]=> int(0) } } [2009-01-17 21:59:53] igulyaev at gmail dot com part of pgsql.c src = estrdup(table_name); tmp_name = php_strtok_r(src, ".", &tmp_name2); if (!*tmp_name2) { /* Default schema */ tmp_name2 = tmp_name; tmp_name = "public"; } in condition tmp_name2 is NULL if table_name without scheme name [2009-01-17 21:06:11] webs dot support at gmail dot com (gdb) where #0 0x000804d338e1 in php_pgsql_meta_data () from /usr/local/lib/php/20060613-debug/pgsql.so #1 0x000804d344e9 in zif_pg_meta_data () from /usr/local/lib/php/20060613-debug/pgsql.so #2 0x005c7e29 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffcf50) at zend_vm_execute.h:200 #3 0x005cea3f in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0x7fffcf50) at zend_vm_execute.h:1729 #4 0x005c7864 in execute (op_array=0x929588) at zend_vm_execute.h:92 #5 0x0059b830 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/ports/lang/php5/work/php-5.2.8/Zend/zend.c:1134 #6 0x0053aecb in php_execute_script (primary_file=0x7fffe890) at /usr/ports/lang/php5/work/php-5.2.8/main/main.c:2023 #7 0x00629957 in main (argc=2, argv=0x7fffea10) at /usr/ports/lang/php5/work/php-5.2.8/sapi/cli/php_cli.c:1133 [2009-01-16 11:30:59] j...@php.net Compile PHP using --enable-debug option and provide a new, useful backtrace. [2009-01-14 06:33:39] ml-php dot net at bettercom dot de postgres-8.3.5 is the version I'm using here (server & libs) The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/47048 -- Edit this bug report at http://bugs.php.net/?id=47048&edit=1
#47048 [Com]: Segfault with new pg_meta_data
ID: 47048 Comment by: igulyaev at gmail dot com Reported By: ml-php dot net at bettercom dot de Status: Feedback Bug Type: PostgreSQL related Operating System: FreeBSD 7.0-RELEASE PHP Version: 5.2.8 New Comment: part of pgsql.c src = estrdup(table_name); tmp_name = php_strtok_r(src, ".", &tmp_name2); if (!*tmp_name2) { /* Default schema */ tmp_name2 = tmp_name; tmp_name = "public"; } in condition tmp_name2 is NULL if table_name without scheme name Previous Comments: [2009-01-17 21:06:11] webs dot support at gmail dot com (gdb) where #0 0x000804d338e1 in php_pgsql_meta_data () from /usr/local/lib/php/20060613-debug/pgsql.so #1 0x000804d344e9 in zif_pg_meta_data () from /usr/local/lib/php/20060613-debug/pgsql.so #2 0x005c7e29 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffcf50) at zend_vm_execute.h:200 #3 0x005cea3f in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0x7fffcf50) at zend_vm_execute.h:1729 #4 0x005c7864 in execute (op_array=0x929588) at zend_vm_execute.h:92 #5 0x0059b830 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/ports/lang/php5/work/php-5.2.8/Zend/zend.c:1134 #6 0x0053aecb in php_execute_script (primary_file=0x7fffe890) at /usr/ports/lang/php5/work/php-5.2.8/main/main.c:2023 #7 0x00629957 in main (argc=2, argv=0x7fffea10) at /usr/ports/lang/php5/work/php-5.2.8/sapi/cli/php_cli.c:1133 [2009-01-16 11:30:59] j...@php.net Compile PHP using --enable-debug option and provide a new, useful backtrace. [2009-01-14 06:33:39] ml-php dot net at bettercom dot de postgres-8.3.5 is the version I'm using here (server & libs) [2009-01-13 18:36:06] il...@php.net What version of PostgreSQL library & server are you using? [2009-01-10 20:57:22] fel...@php.net I can't reproduce it on Linux. PostgreSQL Support => enabled PostgreSQL(libpq) Version => 8.3.5 Multibyte character support => enabled SSL support => enabled Active Persistent Links => 0 Active Links => 0 The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/47048 -- Edit this bug report at http://bugs.php.net/?id=47048&edit=1
#47048 [Com]: Segfault with new pg_meta_data
ID: 47048 Comment by: webs dot support at gmail dot com Reported By: ml-php dot net at bettercom dot de Status: Feedback Bug Type: PostgreSQL related Operating System: FreeBSD 7.0-RELEASE PHP Version: 5.2.8 New Comment: (gdb) where #0 0x000804d338e1 in php_pgsql_meta_data () from /usr/local/lib/php/20060613-debug/pgsql.so #1 0x000804d344e9 in zif_pg_meta_data () from /usr/local/lib/php/20060613-debug/pgsql.so #2 0x005c7e29 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffcf50) at zend_vm_execute.h:200 #3 0x005cea3f in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0x7fffcf50) at zend_vm_execute.h:1729 #4 0x005c7864 in execute (op_array=0x929588) at zend_vm_execute.h:92 #5 0x0059b830 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/ports/lang/php5/work/php-5.2.8/Zend/zend.c:1134 #6 0x0053aecb in php_execute_script (primary_file=0x7fffe890) at /usr/ports/lang/php5/work/php-5.2.8/main/main.c:2023 #7 0x00629957 in main (argc=2, argv=0x7fffea10) at /usr/ports/lang/php5/work/php-5.2.8/sapi/cli/php_cli.c:1133 Previous Comments: [2009-01-16 11:30:59] j...@php.net Compile PHP using --enable-debug option and provide a new, useful backtrace. [2009-01-14 06:33:39] ml-php dot net at bettercom dot de postgres-8.3.5 is the version I'm using here (server & libs) [2009-01-13 18:36:06] il...@php.net What version of PostgreSQL library & server are you using? [2009-01-10 20:57:22] fel...@php.net I can't reproduce it on Linux. PostgreSQL Support => enabled PostgreSQL(libpq) Version => 8.3.5 Multibyte character support => enabled SSL support => enabled Active Persistent Links => 0 Active Links => 0 [2009-01-09 11:38:06] ml-php dot net at bettercom dot de Description: The last changes php_pgsql_meta_data cause segfaults in client and mod_php5 Reproduce code: --- Actual result: -- (gdb) bt #0 0x28606b20 in php_pgsql_meta_data () from /usr/local/lib/php/20060613/pgsql.so #1 0x2860c49b in zif_pg_meta_data () from /usr/local/lib/php/20060613/pgsql.so #2 0x0818be08 in zend_do_fcall_common_helper_SPEC () #3 0x0817d639 in execute () #4 0x0815ffc2 in zend_execute_scripts () #5 0x0811e7b5 in php_execute_script () #6 0x081db5e7 in main () -- Edit this bug report at http://bugs.php.net/?id=47048&edit=1