1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #79332: php_istreams are never freed
This commit is contained in:
Christoph M. Becker
2020-03-02 10:46:31 +01:00
3 changed files with 20 additions and 10 deletions

1
NEWS
View File

@@ -17,6 +17,7 @@ PHP NEWS
. Fixed bug #79248 (Traversing empty VT_ARRAY throws com_exception). (cmb)
. Fixed bug #79299 (com_print_typeinfo prints duplicate variables). (Litiano
Moura)
. Fixed bug #79332 (php_istreams are never freed). (cmb)
- CURL:
. Fixed bug #79019 (Copied cURL handles upload empty file). (cmb)

View File

@@ -248,13 +248,6 @@ static struct IStreamVtbl php_istream_vtbl = {
static void istream_destructor(php_istream *stm)
{
if (stm->res) {
zend_resource *res = stm->res;
stm->res = NULL;
zend_list_delete(res);
return;
}
if (stm->refcount > 0) {
CoDisconnectObject((IUnknown*)stm, 0);
}
@@ -268,7 +261,6 @@ static void istream_destructor(php_istream *stm)
PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream)
{
php_istream *stm = (php_istream*)CoTaskMemAlloc(sizeof(*stm));
zval *tmp;
if (stm == NULL)
return NULL;
@@ -280,8 +272,7 @@ PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream)
stm->stream = stream;
GC_ADDREF(stream->res);
tmp = zend_list_insert(stm, le_istream);
stm->res = Z_RES_P(tmp);
stm->res = zend_register_resource(stm, le_istream);
return (IStream*)stm;
}

View File

@@ -0,0 +1,18 @@
--TEST--
Bug #79332 (php_istreams are never freed)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('com_dotnet extension not available');
?>
--FILE--
<?php
$ph = new COMPersistHelper(null);
try {
$ph->LoadFromStream(fopen(__FILE__, 'r'));
} catch (com_exception $ex) {
// use hard-coded message to avoid localization issues
echo "A com_exception has been thrown\n";
}
?>
--EXPECT--
A com_exception has been thrown