[PHP-DEV] PHP 4.0 Bug #8531: $value = odbc_autocommit($handle) core dump From: hl <email protected>
Date: 01/03/01

From: hl <email protected>
Operating system: RedHat Linux 6.1
PHP version: 4.0.4
PHP Bug Type: ODBC related
Bug description: $value = odbc_autocommit($handle) core dump

When odbc_autocommit function has only the connection id parameter, php crash with a "core dump"!

<?php
$dbh = odbc_connect("localhost:ingoteam", "developer", "*********");
odbc_autocommit($dbh);
odbc_close($dbh);
?>

####### Your Problem!!! #######
file: ext/odbc/php_odbc.c
line: 2338

source:
      :
      :
   pval **pv_conn, **pv_onoff = NULL; #### set to NULL
   int argc;

   argc = ZEND_NUM_ARGS();
   if (argc == 2) {
      if (zend_get_parameters_ex(2, &pv_conn, &pv_onoff) == FAILURE) {
         WRONG_PARAM_COUNT;
      }
   } else if (argc == 1) {
      if (zend_get_parameters_ex(1, &pv_conn) == FAILURE) {
         WRONG_PARAM_COUNT;
      }
   } else {
      WRONG_PARAM_COUNT;
   }

   ZEND_FETCH_RESOURCE2(conn, odbc_connection *, pv_conn, -1, "ODBC-Link", le_conn, le_pconn);

#ifndef HAVE_DBMAKER
   if ((*pv_onoff)) { #### check value of an NULL pointer
#else
   if (pv_onoff && (*pv_onoff)) {
#endif

###############################
When no DBMaker is activ (HAVE_DBMAKER does set), the
line "if ((*pv_onoff))" will not work! There was only
one option, pointer of "pv_onoff" is NULL, but the if-
statement check the value of "pv_onoff"!?

There are no way to check the autocommit status!
###############################

(gdb) r test.php
Starting program: /home/hl/tmp/php-4.0.4/./php test.php

Program received signal SIGSEGV, Segmentation fault.
0x8071aeb in php_if_odbc_autocommit (ht=1, return_value=0x820b44c, this_ptr=0x0, return_value_used=0) at php_odbc.c:2339
2339 if ((*pv_onoff)) {
(gdb) bt
#0 0x8071aeb in php_if_odbc_autocommit (ht=1, return_value=0x820b44c, this_ptr=0x0, return_value_used=0) at php_odbc.c:2339
#1 0x8121c69 in execute (op_array=0x820ff1c) at ./zend_execute.c:1519
#2 0x80eaa1b in zend_execute_scripts (type=8, file_count=3) at zend.c:729
#3 0x80678cc in php_execute_script (primary_file=0xbffff8a0) at main.c:1221
#4 0x8065a49 in main (argc=2, argv=0xbffff914) at cgi_main.c:738
(gdb)

-- 
Edit Bug report at: http://bugs.php.net/?id=8531&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>