Skip to content

Commit

Permalink
Fix #77626: Persistence confusion in php_com_import_typelib()
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cmb69 committed Feb 15, 2019
1 parent 8946ad3 commit 767fa3d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions ext/com_dotnet/com_typeinfo.c
Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down

0 comments on commit 767fa3d

Please sign in to comment.