|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-10-23 13:24 UTC] php at danielknell dot co dot uk
Description:
------------
when trying to do a select query that returns a null value from mssql over the odbc extention (both native and pdo) php exits without returning any output, this seems to happen both for values set to null and for failed left join's.
Reproduce code:
---------------
<?php
$db = odbc_connect('xfndevdb1_regsub', 'webdev', 'H4rdkn0ck');
$result = odbc_exec($db, 'select null as x;');
var_dump(odbc_fetch_array($result));
echo 'end';
Expected result:
----------------
array(1) { ['x']=> NULL }
end
Actual result:
--------------
nothing, even if one tries to echo before the database code.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 11:00:02 2025 UTC |
php -f ./test.php Segmentation fault <?php $db = odbc_connect('test1', 'test', 'test'); $result = odbc_exec($db, 'select null;'); var_dump(odbc_fetch_array($result));Got this happening on Redhat5.4 64bit with Zend Server 4.0.6 PHP 5.2.11, unixODBC-2.2.11-7.1, mysql-connector-odbc-3.51.26r1127-1.el5 MySQL schema: CREATE TABLE `test_null` ( `col1` char(5) default NULL, `col2` char(20) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; INSERT INTO `test_null` VALUES ('AA','AA1'),('BB',NULL); Ran a simple PHP script to select values using odbc_connect(DSN) + odbc_exec(select) Apache crashed on odbc_fetch_array() with core dump, I followed php.net recommendation for debugging and here is the summary: full backtrace up to first "execute" (frame 11) (gdb) bt full #0 0x00002b47dc9d246e in malloc_consolidate () from /lib64/libc.so.6 No symbol table info available. #1 0x00002b47dc9d4a1a in _int_malloc () from /lib64/libc.so.6 No symbol table info available. #2 0x00002b47dc9d6bee in malloc () from /lib64/libc.so.6 No symbol table info available. #3 0x00002b47dca48094 in backtrace_symbols () from /lib64/libc.so.6 No symbol table info available. #4 0x00002b47f716f24a in print_backtrace () at ZendExtUtil.c:57 array = {0x2b47f716f23a, 0x2b47f716f2d5, 0x2b47dc9922d0, 0x2b47dc9de06b, 0x2b47e7186608, 0x2b47f228ddfe, 0x2b47e71c0ce2, 0x2b47e71bfc5c, 0x2b47fcacb842, 0x2b47fd2ea879} size = 10 strings = <value optimized out> #5 0x00002b47f716f2d5 in segvwait () at ZendExtUtil.c:383 No locals. #6 <signal handler called> No symbol table info available. #7 0x00002b47dc9de06b in memcpy () from /lib64/libc.so.6 No symbol table info available. #8 0x00002b47e7186608 in _estrndup (s=0x2b47fdf1da20 "AA1", length=<value optimized out>) at /php-5.2.11/Zend/zend_alloc.c:2444 p = 0x2b47fdff1fe8 "\220?ס‎G+" #9 0x00002b47f228ddfe in ?? () from /usr/local/zend/lib/php_extensions/odbc.so No symbol table info available. #10 0x00002b47e71c0ce2 in zend_do_fcall_common_helper_SPEC (execute_data=0x7fffb2d46fb0) at /php-5.2.11/Zend/zend_vm_execute.h:200 return_reference = 0 '\0' opline = (zend_op *) 0x2b47f89fbf60 original_return_value = <value optimized out> current_scope = (zend_class_entry *) 0x0 current_this = (zval *) 0x0 return_value_used = 2097152 should_change_scope = 0 '\0' #11 0x00002b47e71bfc5c in execute (op_array=0x2b47fdf1d228) at /php-5.2.11/Zend/zend_vm_execute.h:92 execute_data = {opline = 0x2b47f89fbf60, function_state = {function_symbol_table = 0x3, function = 0x2b47f85a6d20, reserved = {0x2b47dac9cd15, 0x2b4700000001, 0x0, 0x23}}, fbc = 0x0, op_array = 0x2b47fdf1d228, object = 0x0, Ts = 0x7fffb2d46f50, CVs = 0x7fffb2d46f20, original_in_execution = 0 '\0', symbol_table = 0x2b47e7780308, prev_execute_data = 0x0, old_error_reporting = 0x0} ... ... (gdb) frame 11 #11 0x00002b47e71bfc5c in execute (op_array=0x2b47fdf1d228) at /php-5.2.11/Zend/zend_vm_execute.h:92 92 /php-5.2.11/Zend/zend_vm_execute.h: No such file or directory. in /php-5.2.11/Zend/zend_vm_execute.h (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name $1 = 0x2b47f228fba4 "odbc_fetch_array" (gdb) Is there anything I can run on the machine / Core dump to give you more information? Thanks Zvika