ID: 33167 User updated by: jsnell at networkninja dot com Reported By: jsnell at networkninja dot com -Status: Feedback +Status: Open Bug Type: PostgreSQL related Operating System: Debian (dotdeb), gentoo PHP Version: 5.0.4 New Comment:
No segfault with the --enable-debug Instead I get: /usr/src/php5-src/php5-5.0.4/ext/pgsql/pgsql.c(1440) : Freeing 0x0856003C (16 bytes), script=breaker.php === Total 1 memory leaks detected === which is: /usr/src/php5-src/php5-5.0.4/ext/pgsql/pgsql.c Also, if the value is manipulated or copied in any way such as casting to int and then recasting to float, the problem seems to go away. Previous Comments: ------------------------------------------------------------------------ [2005-05-28 01:07:20] [EMAIL PROTECTED] Also, try it with the latest snapshot available at http://snaps.php.net ------------------------------------------------------------------------ [2005-05-28 01:05:42] [EMAIL PROTECTED] Please compile PHP with --enable-debug and generate GDB backtrace once more. ------------------------------------------------------------------------ [2005-05-28 00:59:29] jsnell at networkninja dot com Description: ------------ Calling pg_fetch_array() with the results of a division followed by calling it with a constant causes a segfault. I have confirmed it in both cgi and mod php 5.0.4 and also in cgi php 5.0.3. Reproduce code: --------------- // need a valid database to connect to // contents don't matter $query = 'select 1 as one'; $db_user = "your_user"; $db_password = "your_pass"; $db_name = "your_db"; $db_port = 5432; $connect_string = "user=$db_user " . "password=$db_password " . "port=$db_port ". "dbname=$db_name"; $db_link = pg_connect($connect_string); $result = pg_exec($db_link, $query); $i = floor(4/5); $data = pg_fetch_array($result, $i); $i = 0; $data = pg_fetch_array($result, $i); echo("No segfault"); Expected result: ---------------- No segfault Actual result: -------------- gdb backtrace: #0 0x0820cf3b in _zend_hash_index_update_or_next_insert () #1 0x08209c53 in add_index_stringl () #2 0x406bee43 in zif_pg_fetch_result () from /usr/lib/php5/20041030/pgsql.so #3 0x406bf10f in zif_pg_fetch_array () from /usr/lib/php5/20041030/pgsql.so #4 0x0823c4da in zend_do_fcall_common_helper () #5 0x0823cb11 in zend_do_fcall_handler () #6 0x08224cb5 in execute () #7 0x08207e28 in zend_execute_scripts () #8 0x081d8bca in php_execute_script () #9 0x0824c3f4 in main () ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33167&edit=1
