|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 19:00:01 2025 UTC |
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.exeHi, 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.