ID: 49009 Updated by: j...@php.net Reported By: vanessa at mobezeinc dot com -Status: Open +Status: Feedback Bug Type: Scripting Engine problem Operating System: CentOS 5.3 PHP Version: 5.2.10 New Comment:
Did this crash using PHP 5.2.9 ? Previous Comments: ------------------------------------------------------------------------ [2009-07-21 20:42:50] vanessa at mobezeinc dot com Description: ------------ During mysql fetch the php script dies and segmentation fault appears in the appache logs. The code will pull a few rows from the db and after ~10 rows the fault occurs. It happens on both apache 2.2.3 and apache 1.3. Reproduce code: --------------- i've replaced actual values with place holders in some cases. OBCReadDBConn is a wrapper class for mysql functions $readConn = OBCReadDBConn::init(); $query = " select * from TABLENANE order by `table`, `column`, `sort_order`, `desc`, `value` "; $result = $readConn->query($query); $tableDetails = array(); if ($result) { while ($row = $result->getNextRow() ) { do something with the row } } [0xbf848e00] mysql_fetch_assoc() /var/homehtml/html/classes/database/DBResult.php:27 [0xbf84a0d0] getNextRow() /var/homehtml/html/classes/utility/Lookup.php:54 [0xbf84aae0] initLookup() /var/homehtml/html/classes/utility/Lookup.php:159 [0xbf84ac90] getArray() /var/homehtml/html/classes/utility/Lookup.php:244 [0xbf84ae00] getDesc() /var/homehtml/html/classes/utility/Lookup.php:287 [0xbf84d3d0] getLookupDesc() /var/homehtml/html/classes/utility/login_engine.php:717 [0xbf84d5a0] process_login() /var/homehtml/html/login.php:26 Expected result: ---------------- db row array table description "table" "varchar(25)" "NO" "PRI" "" "" "column" "varchar(40)" "NO" "PRI" "" "" "value" "int(2)" "NO" "PRI" "" "" "desc" "varchar(100)" "NO" "" "" "" "misc" "text" "YES" "" \N "" "sort_order" "smallint(2)" "NO" "" "" "" Actual result: -------------- Last lines of xdebug out put 0.1267 2330092 +316 -> DBResult->getNextRow() /home/www/html/classes/utility/Lookup.php:54 0.1268 2330116 +24 -> mysql_fetch_assoc(resource(44) of type (mysql result)) /home/www/html/classes/database/DBResult.php:27 gdb on apache core dump (xdebug not running during this core dump) Core was generated by `/usr/sbin/httpd -k restart'. Program terminated with signal 11, Segmentation fault. [New process 15922] #0 _zend_mm_alloc_int (heap=0x93dc798, size=16) at /var/php-5.2.10/Zend/zend_alloc.c:1785 1785 heap->cache[index] = best_fit->prev_free_block; (gdb) bt full #0 _zend_mm_alloc_int (heap=0x93dc798, size=16) at /var/php-5.2.10/Zend/zend_alloc.c:1785 index = 2 bitmap = <value optimized out> best_fit = <value optimized out> true_size = 24 block_size = <value optimized out> remaining_size = <value optimized out> segment_size = <value optimized out> segment = <value optimized out> keep_rest = <value optimized out> #1 0x0124928f in php_mysql_fetch_hash (ht=<value optimized out>, return_value=0x967e4f0, return_value_ptr=<value optimized out>, this_ptr=0x0, return_value_used=1, result_type=1, expected_args=1, into_object=0) at /var/php-5.2.10/ext/mysql/php_mysql.c:1964 result = (zval **) 0x93e5404 arg2 = (zval **) 0xb5d50ccc mysql_row = (MYSQL_ROW) 0x960e1b8 mysql_field = (MYSQL_FIELD *) 0x960be08 mysql_row_lengths = (long unsigned int *) 0x94c5784 i = 1 res = (zval *) 0x3f2ab784 ctor_params = (zval *) 0x0 ce = (zend_class_entry *) 0x0 #2 0x013f2bc8 in zend_do_fcall_common_helper_SPEC (execute_data=0xbf848e00) at /var/php-5.2.10/Zend/zend_vm_execute.h:200 return_reference = 0 '\0' opline = (zend_op *) 0x9611ef8 original_return_value = <value optimized out> current_scope = (zend_class_entry *) 0x0 current_this = (zval *) 0x0 should_change_scope = 0 '\0' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49009&edit=1