diff options
| author | Christoph M. Becker <cmbecker69@gmx.de> | 2019-02-15 00:39:10 +0100 |
|---|---|---|
| committer | Christoph M. Becker <cmbecker69@gmx.de> | 2019-02-15 00:39:10 +0100 |
| commit | c62e1066103f7a126c8b7e1247d89cac2d230cc0 (patch) | |
| tree | 123f4797b21a2ec9af589e54a89bfdbc3a81840d | |
| parent | fee9f3a8f45e9bc8a85baac07f4852464a752551 (diff) | |
| parent | 8946ad30009af055b5b2fed3044e61c78b7d77fb (diff) | |
| download | php-git-c62e1066103f7a126c8b7e1247d89cac2d230cc0.tar.gz | |
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
Fix #77621: Already defined constants are not properly reported
| -rw-r--r-- | ext/com_dotnet/com_typeinfo.c | 6 | ||||
| -rw-r--r-- | ext/com_dotnet/tests/bug77621.phpt | 18 |
2 files changed, 21 insertions, 3 deletions
diff --git a/ext/com_dotnet/com_typeinfo.c b/ext/com_dotnet/com_typeinfo.c index f80819d1bd..4ee8b327c9 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=== |
