|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43082 PHP exits without output on selecting null values
Submitted: 2007-10-23 13:24 UTC Modified: 2007-11-02 01:00 UTC
Avg. Score:4.0 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: php at danielknell dot co dot uk Assigned:
Status: No Feedback Package: ODBC related
PHP Version: 5.2.4 OS: fedora7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: php at danielknell dot co dot uk
New email:
PHP Version: OS:


 [2007-10-23 13:24 UTC] php at danielknell dot co dot uk
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:
$db = odbc_connect('xfndevdb1_regsub', 'webdev', 'H4rdkn0ck');
$result = odbc_exec($db, 'select null as x;');
echo 'end';

Expected result:
array(1) { ['x']=> NULL }

Actual result:
nothing, even if one tries to echo before the database code.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-23 13:34 UTC] php at danielknell dot co dot uk
this was with freetds 0.64 and mssql server 2005
 [2007-10-25 12:46 UTC]
Try running the script on command line to see if it actually crashes.
 [2007-10-25 13:00 UTC] php at danielknell dot co dot uk
php -f ./test.php
Segmentation fault

$db = odbc_connect('test1', 'test', 'test');
$result = odbc_exec($db, 'select null;');
 [2007-10-25 13:24 UTC]
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 for *NIX and 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.

 [2007-10-25 13:41 UTC] php at danielknell dot co dot uk
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912496243712 (LWP 7734)]
0x00000000005aa9da in _zend_hash_add_or_update ()
(gdb) bt
#0  0x00000000005aa9da in _zend_hash_add_or_update ()
#1  0x00002aaab139a6d7 in ?? () from /usr/lib64/php/modules/
#2  0x00000000005cc792 in ?? ()
#3  0x00000000005bd94c in execute ()
#4  0x000000000059e6a3 in zend_execute_scripts ()
#5  0x000000000055eb78 in php_execute_script ()
#6  0x000000000061e966 in main ()
 [2007-10-25 13:42 UTC]
You need to compile PHP with --enable-debug set in your configure line to get an useful backtrace.
 [2007-11-02 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-12-08 14:05 UTC] zvika at zend dot com
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

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 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/
No symbol table info available.
#1  0x00002b47dc9d4a1a in _int_malloc () from /lib64/
No symbol table info available.
#2  0x00002b47dc9d6bee in malloc () from /lib64/
No symbol table info available.
#3  0x00002b47dca48094 in backtrace_symbols () from /lib64/
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/
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?&#1505;&#8206;G+"
#9  0x00002b47f228ddfe in ?? () from /usr/local/zend/lib/php_extensions/
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"

Is there anything I can run on the machine / Core dump to give you more information?

 [2011-01-10 20:55 UTC] niv at tra dot cx
There seems to be at least a temporary solution, which is to uninstall the patch 
 [2011-09-15 15:34 UTC] hsomel at hotmail dot com

How do I go about removing a patch (odbc-64bits-len.patch) and then re-compiling php.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 12:01:29 2024 UTC