Edit report at https://bugs.php.net/bug.php?id=54007&edit=1
ID: 54007 Comment by: hborrel at gmail dot com Reported by: ken at focusschoolsoftware dot com Summary: odbc seg faults with null data returned from DB2 Status: Open Type: Bug Package: ODBC related Operating System: Linux PHP Version: 5.3.5 Block user comment: N Private report: N New Comment: We have the same problem. As a work around we've had to add this to any feild that may return a NULL. COALESCE(CHAR(DELIVERYDATE), '') Previous Comments: ------------------------------------------------------------------------ [2011-02-13 19:07:17] ken at focusschoolsoftware dot com FYI: php_odbc.c:2158 -> RETURN_STRINGL(result->values[field_ind].value, result- >values[field_ind].vallen, 1); ------------------------------------------------------------------------ [2011-02-13 19:05:10] ken at focusschoolsoftware dot com Backtrace: #0 0x00007ffff6879ea1 in memcpy () from /lib/libc.so.6 #1 0x00000000006af648 in _estrndup (s=0x7ffff57cd4b8 "", length=<value optimized out>) at /usr/include/bits/string3.h:52 #2 0x00007ffff5edadcb in zif_odbc_result (ht=<value optimized out>, return_value=0x7ffff57d6940, return_value_ptr=<value optimized out>, this_ptr=<value optimized out>, return_value_used=<value optimized out>, tsrm_ls=0xc91090) at /home/focus/Development/php-5.3.5/ext/odbc/php_odbc.c:2158 #3 0x000000000072730d in zend_do_fcall_common_helper_SPEC ( execute_data=0x7ffff7ed39a0, tsrm_ls=0xc91090) at /home/focus/Development/php-5.3.5/Zend/zend_vm_execute.h:316 #4 0x00000000006f927b in execute (op_array=0xeeb010, tsrm_ls=0xc91090) at /home/focus/Development/php-5.3.5/Zend/zend_vm_execute.h:107 #5 0x00000000006cec48 in zend_execute_scripts (type=<value optimized out>, tsrm_ls=0xc91090, retval=<value optimized out>, file_count=3) at /home/focus/Development/php-5.3.5/Zend/zend.c:1194 #6 0x0000000000670e2d in php_execute_script ( primary_file=<value optimized out>, tsrm_ls=<value optimized out>) at /home/focus/Development/php-5.3.5/main/main.c:2265 #7 0x0000000000767abe in main (argc=<value optimized out>, argv=<value optimized out>) at /home/focus/Development/php-5.3.5/sapi/cli/php_cli.c:1193 ------------------------------------------------------------------------ [2011-02-13 18:05:53] ka...@php.net Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32 Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. ------------------------------------------------------------------------ [2011-02-13 16:23:02] ken at focusschoolsoftware dot com Description: ------------ This bug happens in many of the odbc functions that handle results from a query, but I'll point out one example: The default case in php_odbc.c: default: if (result->values[field_ind].vallen == SQL_NULL_DATA) { RETURN_NULL(); } else { RETURN_STRINGL(result->values[field_ind].value, result- >values[field_ind].vallen, 1); } break; result->values[field_ind].vallen seems to be corrupted when fetching NULL data on a 64-bit system. Since it does not equal SQL_NULL_DATA, the else clause is executed causing a seg fault because it is trying to handle a NULL case. Test script: --------------- I have no test script to show, because the only as400/db2 server I have access to is behind a VPN at the moemnt. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=54007&edit=1