#37527 [NEW]: Crash - odbc_exec on closed pconnect

From: Date: Fri, 19 May 2006 20:06:48 +0000
Subject: #37527 [NEW]: Crash - odbc_exec on closed pconnect
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97383@lists.php.net to get a copy of this message
From:             bhines at alumni dot ucsd dot edu
Operating system: Windows XP
PHP version:      5.1.4
PHP Bug Type:     Reproducible crash
Bug description:  Crash - odbc_exec on closed pconnect

Description:
------------
php crashes if i connect to a closed ODBC pconnect.  I know this is very
bad code below, but php should probably not crash.

I reproed this with both 5.1.4 and today's 5.2 snapshot.


Reproduce code:
---------------
<?php
$mydb = NULL; 
printPage();
function pdb_Connect()
{
    global $mydb;
    if($mydb == NULL)
    {  /* To repro, you need to supply a valid DSN and user/pass here.
Only crashes with pconnect here, not connect. */                          
                                                
      $mydb = odbc_pconnect("YourDSN", "YourUser", "YourPass",
SQL_CUR_USE_ODBC) or die(odbc_errormsg() ); 
    }                      
    return $mydb;
}
function printPage()
{                
  $mydb = pdb_Connect();
  odbc_close($mydb);
  print "Possibly Crashing now... ";
  $results = odbc_exec($mydb, 'SELECT * FROM _PDB_Access');  
}
?>

Expected result:
----------------
With warnings on, i'd expect something like:

Possibly Crashing now...
Warning: odbc_exec(): supplied argument is not a valid ODBC-Link resource
in d:\inetpub\wwwroot\include\test\testcrash.php on line 20

Actual result:
--------------
Possibly Crashing now... PHP has encountered an Access Violation at
7C901010

-- 
Edit bug report at http://bugs.php.net/?id=37527&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37527&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37527&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37527&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37527&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=37527&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37527&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37527&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37527&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37527&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37527&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=37527&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=37527&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37527&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37527&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37527&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37527&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37527&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37527&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37527&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37527&r=mysqlcfg


Thread (11 messages)

« previous php.bugs (#97383) next »