com php-src: Fix #77626: Persistence confusion in php_com_i mport_typelib(): NEWS ext/com_dotnet/com_typein fo.c
| From: | Christoph Michael Becker | Date: | Fri, 15 Feb 2019 17:56:24 +0000 |
| Subject: | com php-src: Fix #77626: Persistence confusion in php_com_i mport_typelib(): NEWS ext/com_dotnet/com_typein fo.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-104673@lists.php.net to get a copy of this message | ||
Commit: 767fa3dc02f39b64015539d9948874947cf20d5d
Author: Christoph M. Becker <cmbecker69@gmx.de> Fri, 15 Feb 2019 18:50:13 +0100
Parents: 8946ad30009af055b5b2fed3044e61c78b7d77fb
Branches: PHP-7.3 PHP-7..4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=767fa3dc02f39b64015539d9948874947cf20d5d
Log:
Fix #77626: Persistence confusion in php_com_import_typelib()
We apply only the most minimal fix here, and will cater to the
unnecessary re-allocation for PHP-7.4.
We don't need to add a regression test, since bug39606.phpt and
bug77621.phpt already show the misbehavior.
Bugs:
https://bugs.php.net/77626
https://bugs.php.net/39606
https://bugs.php.net/77621
Changed paths:
M NEWS
M ext/com_dotnet/com_typeinfo.c
Diff:
diff --git a/NEWS b/NEWS
index 852eb97..34c4434 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ PHP NEWS
- COM:
. Fixed bug #77621 (Already defined constants are not properly reported).
(cmb)
+ . Fixed bug #77626 (Persistence confusion in php_com_import_typelib()). (cmb)
- Mbstring:
. Fixed bug #77514 (mb_ereg_replace() with trailing backslash adds null byte).
diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c
index 6da55f7..6925e20 100644
--- a/ext/com_dotnet/com_typeinfo.c
+++ b/ext/com_dotnet/com_typeinfo.c
@@ -184,7 +184,7 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
}
const_name = php_com_olestring_to_string(bstr_ids, &len, codepage);
- c.name = zend_string_init(const_name, len, 1);
+ c.name = zend_string_init(const_name, len, mode & CONST_PERSISTENT);
// TODO: avoid reallocation???
efree(const_name);
if(c.name == NULL) {
@@ -200,7 +200,7 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa
if (COMG(autoreg_verbose) && !compare_function(&results, &value, exists)) {
php_error_docref(NULL, E_WARNING, "Type library constant %s is already defined",
ZSTR_VAL(c.name));
}
- zend_string_release_ex(c.name, 1);
+ zend_string_release_ex(c.name, mode & CONST_PERSISTENT);
ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc);
continue;
}