File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -247,13 +247,6 @@ static struct IStreamVtbl php_istream_vtbl = {
247
247
248
248
static void istream_destructor (php_istream * stm )
249
249
{
250
- if (stm -> res ) {
251
- zend_resource * res = stm -> res ;
252
- stm -> res = NULL ;
253
- zend_list_delete (res );
254
- return ;
255
- }
256
-
257
250
if (stm -> refcount > 0 ) {
258
251
CoDisconnectObject ((IUnknown * )stm , 0 );
259
252
}
@@ -267,7 +260,6 @@ static void istream_destructor(php_istream *stm)
267
260
PHP_COM_DOTNET_API IStream * php_com_wrapper_export_stream (php_stream * stream )
268
261
{
269
262
php_istream * stm = (php_istream * )CoTaskMemAlloc (sizeof (* stm ));
270
- zval * tmp ;
271
263
272
264
if (stm == NULL )
273
265
return NULL ;
@@ -279,8 +271,7 @@ PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream)
279
271
stm -> stream = stream ;
280
272
281
273
GC_ADDREF (stream -> res );
282
- tmp = zend_list_insert (stm , le_istream );
283
- stm -> res = Z_RES_P (tmp );
274
+ stm -> res = zend_register_resource (stm , le_istream );
284
275
285
276
return (IStream * )stm ;
286
277
}
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #79332 (php_istreams are never freed)
3
+ --SKIPIF--
4
+ <?php
5
+ if (!extension_loaded ('com_dotnet ' )) die ('com_dotnet extension not available ' );
6
+ ?>
7
+ --FILE--
8
+ <?php
9
+ $ ph = new COMPersistHelper (null );
10
+ try {
11
+ $ ph ->LoadFromStream (fopen (__FILE__ , 'r ' ));
12
+ } catch (com_exception $ ex ) {
13
+ // use hard-coded message to avoid localization issues
14
+ echo "A com_exception has been thrown \n" ;
15
+ }
16
+ ?>
17
+ --EXPECT--
18
+ A com_exception has been thrown
You can’t perform that action at this time.
0 commit comments