#37527 [Opn->Fbk]: Crash - odbc_exec on closed pconnect

From: Date: Sat, 20 May 2006 13:58:28 +0000
Subject: #37527 [Opn->Fbk]: Crash - odbc_exec on closed pconnect
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97408@lists.php.net to get a copy of this message
 ID:               37527
 Updated by:       tony2001@php.net
 Reported By:      bhines at alumni dot ucsd dot edu
-Status:           Open
+Status:           Feedback
 Bug Type:         Reproducible crash
 Operating System: Windows XP
 PHP Version:      5.1.4
 New Comment:

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.




Previous Comments:
------------------------------------------------------------------------

[2006-05-19 20:06:48] bhines at alumni dot ucsd dot edu

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 this bug report at http://bugs.php.net/?id=37527&edit=1


Thread (11 messages)

« previous php.bugs (#97408) next »