[PHP-DEV] Bug #10671 Updated: Cannot retrieve secondary object properties From: derick <email protected>
Date: 05/07/01

ID: 10671
Updated by: derick
Reported By: sasha <email protected>
Old-Status: Open
Status: Closed
Bug Type: COM related
Operating system:
PHP Version: 4.0.5
Assigned To:
Comments:

user says it's fixed

Previous Comments:
---------------------------------------------------------------------------

[2001-05-07 13:16:33] sasha <email protected>
IT turns out this bug has been fixed in
ext/com/conversion.c 1.8

Thanks
Sasha

---------------------------------------------------------------------------

[2001-05-07 12:47:55] sbergmann <email protected>
Does this problem persist with PHP 4.0.6-dev? There have been a lot of changes to ext/com recently, including improtant fixes after the PHP 4.0.5 release that will be included in PHP 4.0.6.

---------------------------------------------------------------------------

[2001-05-04 12:33:46] sasha <email protected>
The following code causes PHP to die at line 3:
$mgr = new COM("Factory");
$child = $mgr->GetChild(1);
echo $child->Attribute;

($mgr's method GetChild returns a COM object, which
has property 'Attribute').

The bug is in php_variant_to_pval() function in
ext/com/conversion.c, line 501:
 handle->value.lval = zend_list_insert(var_arg->pdispVal, php_COM_get_le_idispatch());

it saves raw interface pointer var_arg->pdispVal, whereas everywhere else it is expected that the list contains i_dispatch pointer.

The line should be replaced with
 i_dispatch *obj = (i_dispatch *)emalloc(sizeof(*obj));
 php_COM_set(obj,var_arg->pdispVal,FALSE); // not sure whether the last parameter should be TRUE or FALSE
 handle->value.lval = zend_list_insert(obj, php_COM_get_le_idispatch());
 

Also, the code in php_COM_set is somewhat bizarre:
- the returned value (hr) will not be set if cleanup is FALSE
- pDisp is unnecessarily cleared if cleanup is FALSE (it's a parameter, and it's not used afterwards).

Also, I am not sure that reference counting for COM objects is correct.

Also, please comment your code. It took me a day to find out this little bug.

Sasha

---------------------------------------------------------------------------

ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10671&edit=2

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>