php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48585 com_load_typelib holds reference, fails on second call
Submitted: 2009-06-17 15:19 UTC Modified: 2020-08-04 14:32 UTC
Votes:8
Avg. Score:3.8 ± 0.8
Reproduced:6 of 6 (100.0%)
Same Version:2 (33.3%)
Same OS:3 (50.0%)
From: robert dot johnson at icap dot com Assigned: cmb (profile)
Status: Closed Package: COM related
PHP Version: 5.2.9 OS: Win XP sp3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: robert dot johnson at icap dot com
New email:
PHP Version: OS:

 

 [2009-06-17 15:19 UTC] 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_user@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

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-03 19:03 UTC] marc at parknpool dot com
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
 [2011-12-19 09:56 UTC] hendri dot cacem at gmail dot com
Same to my version:
PHP Version: 5.3.1
XAMPP 1.7.3
 [2014-03-04 12:50 UTC] melvingroenhoff at gmail dot com
As of PHP 5.4.24 this is still true
 [2020-08-04 14:32 UTC] cmb@php.net
-Status: Open +Status: Analyzed -Assigned To: +Assigned To: cmb
 [2020-08-04 14:32 UTC] cmb@php.net
The problem is that while the type library is properly cached, the
actual import is not.
 [2020-08-04 16:29 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #48585: com_load_typelib holds reference, fails on second call
On GitHub:  https://github.com/php/php-src/pull/5934
Patch:      https://github.com/php/php-src/pull/5934.patch
 [2020-08-11 09:29 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=dc108feab8d88f62d7fcba3d2c9a058432463118
Log: Fix #48585: com_load_typelib holds reference, fails on second call
 [2020-08-11 09:29 UTC] cmb@php.net
-Status: Analyzed +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC