|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-05-30 09:59 UTC] phanto@php.net
[2002-05-30 19:19 UTC] phanto@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 09:00:01 2025 UTC |
hello I wrote a script to access ADO database: ---------------------------------------------------- $conn = new COM('ADODB.Connection'); $hr = $conn->Open('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=test.mdb',"", "", 0); $oCmd = new COM('ADODB.Command'); $oCmd->ActiveConnection = $conn; $oCmd->CommandText = "INSERT INTO config(storage) VALUES('testowa wartosc')"; $oCmd->CommandType = 1; $rs = $oCmd->Execute(); ---------------------------------------------------- in line $oCmd->ActiveConnection = $conn; there is created a zendval variable (result from assigning IDispatch $conn to property) but $conn is not AddRef-ed... When this invisible variable is destroyed it calls Release on IDispatch from $conn - But this dispatch is already 0-referenced. I isolated the code in file COM.c in line 1142 (function do_COM_propput): --------------------------------------------------- if (SUCCEEDED(hr)) { php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC); } else { -------------------------------------------------- and changed to: --------------------------------------------------- if (SUCCEEDED(hr)) { if ( var_result->vt == VT_DISPATCH ) var_result->pdispVal->lpVtbl->AddRef(var_result->pdispVal); php_variant_to_pval(var_result, return_value, codepage TSRMLS_CC); } else { ---------------------------------------------------- Is it a good solution? Or maybe I don't understand something? Tristan Rybak