php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10580 Access Violation using ADODB
Submitted: 2001-05-01 10:54 UTC Modified: 2001-06-02 21:24 UTC
From: jason at hspace dot net Assigned:
Status: Closed Package: COM related
PHP Version: 4.0.7-dev (dated 18-May-2001) OS: Win2k
Private report: No CVE-ID: None
 [2001-05-01 10:54 UTC] jason at hspace dot net
Access Violation on this line:

$fields = $rs->Fields;

where $rs is the recordset from the database.
Error occurs with PHP 4.0.5 final release,
and does not occur with PHP 4.0.5 RC1.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-01 11:05 UTC] jason at hspace dot net
If it helps, here is the error message:

PHP has encountered an Access Violation at 2474FF04

I got the following error messages when using MSXML Parser 3.01 to load an XML string:

PHP has encountered an Access Violation at 011C2655

and

PHP has encountered an Access Violation at 011C265B

 [2001-05-04 10:28 UTC] phanto@php.net
same as #10594
 [2001-05-04 11:29 UTC] sniper@php.net
This is now fixed in CVS. Fix will be in 4.0.6.

--Jani

 [2001-05-04 22:54 UTC] jason at hspace dot net
Same bug, access violation using ADODB and MSXML Parser,
but using a 4.0.6 build, dated 2001-05-04.

 [2001-05-08 16:30 UTC] phanto@php.net
could you provide a short snippet, i can't reproduce this.
are you using the cgi or the isapi version ?
 [2001-05-08 19:18 UTC] jason at hspace dot net
Here is a code snippet for testing ADODB:

<?php

define ("DSN_USER", "sa");
define ("DSN_PWD", "");
define ("DB_SERVERNAME", "localhost");
define ("DATABASENAME", "Northwind");

define ("OLEDB_CONNECTION_STRING", "Provider=SQLOLEDB; Data Source=".DB_SERVERNAME."; Initial Catalog=".DATABASENAME."; User ID=".DSN_USER."; Password=".DSN_PWD);

$conn = new COM("ADODB.Connection") or die("Cannot start ADO");

$conn->Open(OLEDB_CONNECTION_STRING);

$command = "SELECT * from employees";

$rs = $conn->Execute($command);	// Recordset
$num_columns = $rs->Fields->Count();

$this->set_arr($num_columns);

for ($i=0; $i < $num_columns; $i++) {
	$fld[$i] = $rs->Fields($i);
}
$rowcount = 0;
while (!$rs->EOF) {
	for ($i=0; $i < $num_columns; $i++) {
		$arr[$i][$rowcount] = $fld[$i]->value;
	}
	$rowcount++;			// increments rowcount
	$rs->MoveNext();
}

$rs->Close();
$conn->Close();

$rs = NULL;
$conn = NULL;

?>

This produces the error: PHP has encountered an Access Violation at 2474FF04

You can also produce an Access Violation by trying to use MSXML Parser 3.0,
and by calling the loadXML() method.

I downloaded php 4.0.6-dev [2001-05-04] build from php4win32.sourceforge.net/releases/php-4.0.6-dev-20010504.exe
 [2001-05-08 20:12 UTC] phanto@php.net
works here.

the only mistake i found was, that if either the connect string or the query was wrong $conn->execute() returned a nullpointer instead of a valid recordset.
this only produced a warning so there was a nullpointer exception at the first attempt to access $rs->...
now i produce an error (unfortunatelly this causes the script to stop).
i'll fix this in the code and switch back to a warning, but i think it's ok for now.
 [2001-05-16 08:34 UTC] jason at hspace dot net
Bug reopened, CVS dated 16 May 2001,

message when accessing database:
PHP has encountered an Access Violation at 011CD614

 [2001-05-16 08:42 UTC] jason at hspace dot net
COM broken in PHP version 4.0.7-dev
 [2001-05-18 11:24 UTC] phanto@php.net
is it ? i was able to run your ado script successfully. are you using the isapi or the cgi version of php. isapi isn't stable yet.

-harald
 [2001-05-18 22:45 UTC] jason at hspace dot net
Hi,

The current version (18-May) could not load in Windows at all, so I cannot test that version. Curiously, the version number of PHP is 4.0.7-dev.
Testing the last version (17-May), I found that the error is generated when it executes this line of code:

for ($rowcount = 0; !$rs->EOF;
   ++$rowcount, $rs->MoveNext()) {

  // some code

}

Specifically, it is the condition ( $rs->EOF ) that causes the Access Violation. All else works ok.
$rs->EOF should return a boolean datatype.

MSXMLParser also still causes Access Violation when calling loadXML($xmldata)

When running PHP as CGI (for the MSXMLParser script), I get this Application Error message:
"The instruction at "0x1008d824" referenced memory at "0x3c0a3e64". The memory could not be "written"."

The last version that worked with COM was PHP 4.0.6-dev, before it turned 4.0.7-dev.

 [2001-05-19 09:04 UTC] phanto@php.net
hmm, i haven't changed anything since the 15.3.2001. but afaik there where changes in the zend-api after branching 4.0.6. maybe they are causing these errors with isapi.
do you have any problems with adodb and the cgi version ?

the problem with the XML Parser is known (#10851), but at the moment i don't know the reason. maybe someone could help investigating .. ;)
 [2001-06-02 21:24 UTC] phanto@php.net
MSXMLParser seems to work now. the isapi version of php is very unstable, but seems to work now too. there where a few changes in the zend core that fixed the problems.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 02 13:01:29 2024 UTC