From: denis dot bykov at cleancode dot ru
Operating system: FreeBSD 8.0-RELEASE
PHP version: 5.2.11
PHP Bug Type: PostgreSQL related
Bug description: PHP crashes with pgsql extension
Description:
------------
PHP (installed from ports) crashes with pgsql extension
php5-5.2.11
php5-pgsql-5.2.11_1
postgresql-server-8.2.13
postgresql-client-8.2.13
It crashes regardless of code.
For example, it crashes on <?phpinfo();?>
Reproduce code:
---------------
extension=pgsql.so
create file phpinfo.php with this content:
<?phpinfo();?>
run
$php phpinfo.php
Expected result:
----------------
phpinfo() output
Actual result:
--------------
localhost$ php phpinfo.php
[Wed Dec 16 17:55:37 2009] Script: '-'
---------------------------------------
/usr/ports/lang/php5/work/php-5.2.11/ext/standard/dl.c(158) : Block
0x2871d224 status:
Invalid pointer: ((thread_id=0x28691128) != (expected=0x287033C0))
---------------------------------------
[Wed Dec 16 17:55:37 2009] Script: '-'
---------------------------------------
/usr/ports/lang/php5/work/php-5.2.11/Zend/zend_variables.c(162) : Block
0x2871c120 status:
/usr/ports/lang/php5/work/php-5.2.11/Zend/zend_variables.c(35) : Actual
location (location was relayed)
Invalid pointer: ((thread_id=0x28691128) != (expected=0x287033C0))
---------------------------------------
Segmentation fault (core dumped)
backtrace:
(gdb) bt
#0 0x081c726f in _zend_hash_index_update_or_next_insert (ht=0x28711d68,
h=0, pData=0xbfbfe714, nDataSize=12,
pDest=0x0, flag=1, __zend_filename=0x82ca318
"/usr/ports/lang/php5/work/php-5.2.11/Zend/zend_list.c",
__zend_lineno=47) at
/usr/ports/lang/php5/work/php-5.2.11/Zend/zend_hash.c:359
#1 0x081ca07e in zend_list_insert (ptr=0x287ba020, type=2) at
/usr/ports/lang/php5/work/php-5.2.11/Zend/zend_list.c:47
#2 0x081ca228 in zend_register_resource (rsrc_result=0x0,
rsrc_pointer=0x287ba020, rsrc_type=2)
at /usr/ports/lang/php5/work/php-5.2.11/Zend/zend_list.c:99
#3 0x0816dc0c in _php_stream_alloc (ops=0x82e47a0, abstract=0x287b9f70,
persistent_id=0x0, mode=0x82d1f8f "rb",
__php_stream_call_depth=2,
__zend_filename=0x82b12f8
"/usr/ports/lang/php5/work/php-5.2.11/main/streams/plain_wrapper.c",
__zend_lineno=169,
__zend_orig_filename=0x82a8aac
"/usr/ports/lang/php5/work/php-5.2.11/ext/standard/php_fopen_wrapper.c",
__zend_orig_lineno=322, tsrm_ls=0x28702040) at
/usr/ports/lang/php5/work/php-5.2.11/main/streams/streams.c:267
#4 0x08177325 in _php_stream_fopen_from_file_int (file=0x2867a560,
mode=0x82d1f8f "rb", __php_stream_call_depth=1,
__zend_filename=0x82b12f8
"/usr/ports/lang/php5/work/php-5.2.11/main/streams/plain_wrapper.c",
__zend_lineno=257,
__zend_orig_filename=0x82a8aac
"/usr/ports/lang/php5/work/php-5.2.11/ext/standard/php_fopen_wrapper.c",
__zend_orig_lineno=322, tsrm_ls=0x28702040) at
/usr/ports/lang/php5/work/php-5.2.11/main/streams/plain_wrapper.c:169
#5 0x0817779f in _php_stream_fopen_from_file (file=0x2867a560,
mode=0x82d1f8f "rb", __php_stream_call_depth=0,
__zend_filename=0x82a8aac
"/usr/ports/lang/php5/work/php-5.2.11/ext/standard/php_fopen_wrapper.c",
__zend_lineno=322, __zend_orig_filename=0x0, __zend_orig_lineno=0,
tsrm_ls=0x28702040)
at
/usr/ports/lang/php5/work/php-5.2.11/main/streams/plain_wrapper.c:257
#6 0x0813832d in php_stream_url_wrap_php (wrapper=0x82e2c08,
path=0x82d1f98 "stdin", mode=0x82d1f8f "rb", options=8,
opened_path=0x0, context=0x0, __php_stream_call_depth=1,
__zend_filename=0x82b09d0
"/usr/ports/lang/php5/work/php-5.2.11/main/streams/streams.c",
__zend_lineno=1829,
__zend_orig_filename=0x82d17bc
"/usr/ports/lang/php5/work/php-5.2.11/sapi/cli/php_cli.c",
__zend_orig_lineno=522,
tsrm_ls=0x28702040) at
/usr/ports/lang/php5/work/php-5.2.11/ext/standard/php_fopen_wrapper.c:322
#7 0x0817203a in _php_stream_open_wrapper_ex (path=0x82d1f92
"php://stdin", mode=0x82d1f8f "rb", options=0,
opened_path=0x0, context=0x0, __php_stream_call_depth=0,
__zend_filename=0x82d17bc
"/usr/ports/lang/php5/work/php-5.2.11/sapi/cli/php_cli.c",
__zend_lineno=522,
__zend_orig_filename=0x0, __zend_orig_lineno=0, tsrm_ls=0x28702040)
at /usr/ports/lang/php5/work/php-5.2.11/main/streams/streams.c:1827
#8 0x082464d8 in cli_register_file_handles (tsrm_ls=0x28702040)
at /usr/ports/lang/php5/work/php-5.2.11/sapi/cli/php_cli.c:522
#9 0x082478a8 in main (argc=2, argv=0xbfbfec6c) at
/usr/ports/lang/php5/work/php-5.2.11/sapi/cli/php_cli.c:1081
--
Edit bug report at http://bugs.php.net/?id=50495&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50495&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50495&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50495&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50495&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50495&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50495&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50495&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50495&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50495&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50495&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50495&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50495&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50495&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50495&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50495&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50495&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50495&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50495&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50495&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50495&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50495&r=mysqlcfg