summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2019-03-18 19:22:51 +0100
committerChristoph M. Becker <cmbecker69@gmx.de>2019-03-18 19:24:56 +0100
commita529826d95f07eb0e1a646b1b427eb0537deff3d (patch)
tree1ea12ca7c64b193dd53f98f6ab3b2b2e5bbc854b
parent7ef2fa6d0dd9972244cbc490bb3ff11cf050befe (diff)
parent41bc51ce2d217aa7aca85b4be289bebf91813423 (diff)
downloadphp-git-a529826d95f07eb0e1a646b1b427eb0537deff3d.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #77578: Crash when php unload
-rw-r--r--NEWS3
-rw-r--r--ext/com_dotnet/com_typeinfo.c4
-rw-r--r--ext/com_dotnet/tests/bug77578.phpt23
3 files changed, 28 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index f6f51119dc..95e14257f3 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,9 @@ PHP NEWS
- Apache2Handler:
. Fixed bug #77648 (BOM in sapi/apache2handler/php_functions.c). (cmb)
+- COM:
+ . Fixed bug #77578 (Crash when php unload). (cmb)
+
- FPM:
. Fixed bug #77677 (FPM fails to build on AIX due to missing WCOREDUMP).
(Kevin Adler)
diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c
index 6925e20379..330d7b0052 100644
--- a/ext/com_dotnet/com_typeinfo.c
+++ b/ext/com_dotnet/com_typeinfo.c
@@ -222,8 +222,8 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
/* Type-library stuff */
void php_com_typelibrary_dtor(zval *pDest)
{
- ITypeLib **Lib = (ITypeLib**)Z_PTR_P(pDest);
- ITypeLib_Release(*Lib);
+ ITypeLib *Lib = (ITypeLib*)Z_PTR_P(pDest);
+ ITypeLib_Release(Lib);
}
PHP_COM_DOTNET_API ITypeLib *php_com_load_typelib_via_cache(char *search_string,
diff --git a/ext/com_dotnet/tests/bug77578.phpt b/ext/com_dotnet/tests/bug77578.phpt
new file mode 100644
index 0000000000..e68494468e
--- /dev/null
+++ b/ext/com_dotnet/tests/bug77578.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Bug #77578 (Crash when php unload)
+--SKIPIF--
+<?php
+if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
+?>
+--FILE--
+<?php
+// To actually be able to verify the crash during shutdown on Windows, we have
+// to execute a PHP subprocess, and check its exit status.
+$php = PHP_BINARY;
+$ini = php_ini_loaded_file();
+$iniopt = $ini ? "-c $ini" : '';
+$command = "$php $iniopt -d com.autoregister_typelib=1 -r \"new COM('WbemScripting.SWbemLocator');\"";
+exec($command, $output, $status);
+var_dump($output, $status);
+?>
+===DONE===
+--EXPECT--
+array(0) {
+}
+int(0)
+===DONE===