ID: 48585 Comment by: marc at parknpool dot com Reported By: robert dot johnson at icap dot com Status: Open Bug Type: COM related Operating System: Win XP sp3 PHP Version: 5.2.9 New Comment:
I am having the same problem. I use com_load_typelib to load COM constants. The result of calling com_load_typelib always returns true. However, the constants are defined on the first call and undefined for each subsequent call to the page I am testing. This is true when I go away from the page or switch browsers. Apparently restarting the web server (Apache) resets the system state and I can see the constants again, but on the first call only. OS: Windows Server 2008 PHP Version: 5.2.6 In php.ini: com.allow_dcom = true com.autoregister_typelib = true com.autoregister_casesensitive = false com.autoregister_verbose = true Previous Comments: ------------------------------------------------------------------------ [2009-06-17 15:19:03] robert dot johnson at icap dot com Description: ------------ com_load_typelib successfully loads a type library defintitions on its first call. It fails on the second call, and the previous definitions disappear. Other points: First call holds a reference to the type library which does not get released until the web server (Apache 2.2) is stopped. If you're creating define()'s, why do you need to hold a library reference - you could load the types then release the references? This behaviour is the same when php.ini contains 'com.autoregister_typelib=1', instead of calling com_load_typelib. Reproduce code: --------------- This uses a private COM object, but if you want a copy it's no problem. //////////////////////////// function test() { com_load_typelib('{8F387CCB-379F-4F13-9470-9D04DF3B04F8},1,0'); $domain = ''; $dns = 'some_u...@domain.com'; $wincall = new COM('wincall.wincall'); $snu = $wincall->LookupAccount('', $dns, $domain); echo 'SidTypeUser == ' . SidTypeUser . "<br />\r\n"; } test(); ///////////////////////////// Run this script twice... Expected result: ---------------- // first call of script: SidTypeUser == 1 // second call of script: SidTypeUser == 1 Actual result: -------------- // first call of script: SidTypeUser == 1 // second call of script: SidTypeUser == SidTypeUser ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48585&edit=1