diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2019-02-15 00:37:39 +0100 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2019-02-15 00:37:39 +0100 |
commit | 8946ad30009af055b5b2fed3044e61c78b7d77fb (patch) | |
tree | 84cea34d0abe6938a125c1dffed3df8559d7d3f0 | |
parent | eb063c8a9f130f2981c590d31aa2dd548a8d523b (diff) | |
parent | de738496c2c323b580d9aff0f121876e4101a910 (diff) | |
download | php-git-8946ad30009af055b5b2fed3044e61c78b7d77fb.tar.gz |
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
Fix #77621: Already defined constants are not properly reported
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/com_dotnet/com_typeinfo.c | 6 | ||||
-rw-r--r-- | ext/com_dotnet/tests/bug77621.phpt | 18 |
3 files changed, 25 insertions, 3 deletions
@@ -14,6 +14,10 @@ PHP NEWS . Fixed bug #77530 (PHP crashes when parsing `(2)::class`). (Ekin) . Fixed bug #77546 (iptcembed broken function). (gdegoulet) +- COM: + . Fixed bug #77621 (Already defined constants are not properly reported). + (cmb) + - Mbstring: . Fixed bug #77514 (mb_ereg_replace() with trailing backslash adds null byte). (Nikita) diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c index 0ba344fd9e..6da55f7477 100644 --- a/ext/com_dotnet/com_typeinfo.c +++ b/ext/com_dotnet/com_typeinfo.c @@ -195,9 +195,10 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa SysFreeString(bstr_ids); /* sanity check for the case where the constant is already defined */ + php_com_zval_from_variant(&value, pVarDesc->lpvarValue, codepage); if ((exists = zend_get_constant(c.name)) != NULL) { - if (COMG(autoreg_verbose) && !compare_function(&results, &c.value, exists)) { - php_error_docref(NULL, E_WARNING, "Type library constant %s is already defined", c.name); + 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); ITypeInfo_ReleaseVarDesc(TypeInfo, pVarDesc); @@ -205,7 +206,6 @@ PHP_COM_DOTNET_API int php_com_import_typelib(ITypeLib *TL, int mode, int codepa } /* register the constant */ - php_com_zval_from_variant(&value, pVarDesc->lpvarValue, codepage); if (Z_TYPE(value) == IS_LONG) { ZEND_CONSTANT_SET_FLAGS(&c, mode, 0); ZVAL_LONG(&c.value, Z_LVAL(value)); diff --git a/ext/com_dotnet/tests/bug77621.phpt b/ext/com_dotnet/tests/bug77621.phpt new file mode 100644 index 0000000000..5c24494637 --- /dev/null +++ b/ext/com_dotnet/tests/bug77621.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #77621 (Already defined constants are not properly reported) +--SKIPIF-- +<?php +if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available'); +?> +--INI-- +com.autoregister_verbose=1 +--FILE-- +<?php +define('ADSTYPE_INVALID', 0); +$root = dirname(array_change_key_case($_SERVER, CASE_UPPER)['COMSPEC']); +com_load_typelib("$root\activeds.tlb"); +?> +===DONE=== +--EXPECTF-- +Warning: com_load_typelib(): Type library constant ADSTYPE_INVALID is already defined in %s on line %d +===DONE=== |