Fixed bug #34272 (empty array onto COM object blows up)

fix mem leaks
WS fixes
add test
This commit is contained in:
Rob Richards 2006-02-04 10:57:28 +00:00
parent aa1142eded
commit a78a0b460c
3 changed files with 25 additions and 1 deletions

View File

@ -634,9 +634,11 @@ void php_com_object_free_storage(void *object TSRMLS_DC)
VariantClear(&obj->v);
if (obj->method_cache) {
zend_hash_destroy(obj->method_cache);
FREE_HASHTABLE(obj->method_cache);
}
if (obj->id_of_name_cache) {
zend_hash_destroy(obj->id_of_name_cache);
FREE_HASHTABLE(obj->id_of_name_cache);
}
efree(obj);

View File

@ -40,7 +40,7 @@ static void safe_array_from_zval(VARIANT *v, zval *z, int codepage TSRMLS_DC)
int keytype;
char *strindex;
int strindexlen;
long intindex;
long intindex = -1;
long max_index = 0;
VARIANT *va;
zval **item;

View File

@ -0,0 +1,22 @@
--TEST--
Bug #34272 (empty array onto COM object blows up)
--SKIPIF--
<?php
if (!extension_loaded("com_dotnet")) print "skip COM/.Net support not present"; ?>
--FILE--
<?php
error_reporting(E_ALL);
try {
$dict = new COM("Scripting.Dictionary");
$dict->add('foo', array());
print sizeof($dict['foo'])."\n";
$dict->add('bar', array(23));
print sizeof($dict['bar'])." \n";
} catch (Exception $e) {
print $e;
}
?>
--EXPECT--
0
1