From:             [EMAIL PROTECTED]
Operating system: Windows 2000 SP2 German
PHP version:      4.1.2
PHP Bug Type:     COM related
Bug description:  fatal error using MS ADOX-library

php binary: v4.1.2 downloaded from www.php4win.de
adodb: ms activex data objects 2.7 library
adox : ms ado ext. 2.5 for dll and security
webserver: apache 1.3.20

......................................................

a fatal error occured with following original message:
"Die Anweisung in '0x100829c3' verweist auf Speicher in 0x00000008. Der
Vorgang 'read' konnte nicht in den Speicher durchgeführt werden."

english (similar):
"Statement at '0x100829c3' refers to memory 0x00000008. memory-process
'read' could not be executed"

error log: Premature end of script headers: path-to/php.exe

......................................................

at the end of this bug-report i post a sample-script, which you can test
it. trivial: the fatal error occured always if the script is finished.

please look in function tableExists, statement @$cat-ActiveConnection. 
the supply of an adodb.connection object
occurs fatal error with an access oledb-provider as sql-server
oledb-provider.


......................................................
<?php


class test {

var $connection;
var $user       = "Admin";
var $pw         = "";
var $connstr    = "Provider=Microsoft.Jet.OLEDB.4.0;
                   Data Source=path-to\Nordwind.mdb;
                   Persist Security Info=False";

    function test()
    {
        $this->connection = new COM("ADODB.Connection");

        if (!$this->connection) {
            die (print "could not create an instance of
adodb.connection");
        }
        @$this->connection->Open($this->connstr, $this->user, $this->pw);
    }


    function tableExists($value)
    {
        $ok = false;
        $cat = new COM("ADOX.Catalog");

        if ($cat) {
            //@$cat->ActiveConnection = $this->connection; //<-- with this
statement we receive a fatal error
            @$cat->ActiveConnection = $this->connection->ConnectionString;
//<-- but setting the conn-string works fine

            $tables = @$cat->Tables;
            $count = $tables->Count();
            
            for($i = 0; $i < $count; $i++) {
                $table = $tables->Item($i);
                if (strtolower($table->Type) != "view" &&
                        strtolower($table->Name) == strtolower($value)) {
                    $ok = true;
                    break;
                }
            }
            $table->Release(); $table = null; unset($table);
            $tables->Release(); $tables = null; unset($tables);
            $cat->Release();  $cat = null; unset($cat);
        }
        return $ok;
    }

} // end class


$test = new test();
$ret = $test->tableExists("dummy_table");

echo (integer) ret;
?>
-- 
Edit bug report at http://bugs.php.net/?id=16720&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=16720&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=16720&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=16720&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=16720&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16720&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=16720&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=16720&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=16720&r=submittedtwice

Reply via email to