PHP 4.0 Bug #2943: php.exe crashes on odbc_exec()
| From: | p dot reynolds at sheffield dot ac dot uk | Date: | Thu, 09 Dec 1999 17:42:36 +0000 |
| Subject: | PHP 4.0 Bug #2943: php.exe crashes on odbc_exec() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-13523@lists.php.net to get a copy of this message | ||
From: p.reynolds@sheffield.ac.uk
Operating system: NT4S SP6a
PHP version: 4.0 Beta 3
PHP Bug Type: ODBC related
Bug description: php.exe crashes on odbc_exec()
When I try to issue an "odbc_exec()" command to interrogate a MS Access database through
ODBC4, PHP.EXE crashes with the following DrWatson message:
"Exception: access violation (0x0000005), Address: 0x1f42cf70"
This did not happen with PHPv3 - the script worked perfectly.
The following script can reproduce the error:
<HTML>
<HEAD>
<TITLE>Test ODBC</TITLE>
</HEAD>
<BODY>
<?
//__________________________________________________________
//
// test_odbc.php3
// A sample PHP script to test ODBC under PHP / WinNT
// Leo West - 08/1998
//__________________________________________________________
function Error_Handler( $msg, $cnx )
{
echo "$msg \n";
// in case of persistent connexion, it is important to close it before exiting.
odbc_close( $cnx);
exit();
}
// create an ODBC connection, returned in $cnx
$cnx = odbc_connect( 'WebDB' , 'webuser', 'webpassword' );
if( ! $cnx ) {
Error_handler( "Error in odbc_connect" , $cnx );
}
// send a simple odbc query . returns an odbc cursor
//***THIS IS WHERE THE CRASH OCCURS***
$cur= odbc_exec( $cnx, "select id,nom from T_FrenchTown" );
if( ! $cur ) {
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}
echo "<table
border=1><tr><th>id</th><th>nom</th></tr>\n";
$nbrow=0;
// fetch the succesive result rows
while( odbc_fetch_row( $cur ) )
{
$nbrow++;
// get the field "id"
$id= odbc_result( $cur, 1 );
// get the field "nom"
$nom= odbc_result( $cur, 2 );
echo "<tr><td>$id</td><td>$nom</td></tr>\n";
}
echo "<tr><td colspan=2>$nbrow entries </td></tr></table>";
// close the connection. important if persistent connection are "On"
odbc_close( $cnx);
?>
</BODY>
</HTML>
I have not included the php.ini file as I have not changed it from the default version included with
the PHP4 distribution.
I am currently running Apache 1.3.9 on a Windows NT4S with SP6a installed. I have also installed
ODBC version 4.