php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2943 php.exe crashes on odbc_exec()
Submitted: 1999-12-09 12:42 UTC Modified: 2000-06-20 11:18 UTC
From: p dot reynolds at sheffield dot ac dot uk Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0 Beta 3 OS: NT4S SP6a
Private report: No CVE-ID: None
 [1999-12-09 12:42 UTC] p dot reynolds at sheffield dot ac dot uk
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-12-15 07:05 UTC] p dot reynolds at sheffield dot ac dot uk
Since I posted this bug, I have noticed that the Event Viewer shows the following message each time php crashes:

Event ID 15 "The device, \Device\Harddisk4\Partition0, is not ready for access yet."

Also, I have checked whether php crashes on an "odbc_prepare()" command. It does. Therefore, this bug might be related to bug number 2886.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 23:01:29 2024 UTC