Merge branch 'PHP-7.3' into PHP-7.4

* PHP-7.3:
  Fix #79242: COM error constants don't match com_exception codes
This commit is contained in:
Christoph M. Becker 2020-02-07 18:04:52 +01:00
commit 7f86f9972e
3 changed files with 29 additions and 1 deletions

2
NEWS
View file

@ -6,6 +6,8 @@ PHP NEWS
- COM:
. Fixed bug #66322 (COMPersistHelper::SaveToFile can save to wrong location).
(cmb)
. Fixed bug #79242 (COM error constants don't match com_exception codes on
x86). (cmb)
- CURL:
. Fixed bug #79019 (Copied cURL handles upload empty file). (cmb)

View file

@ -341,11 +341,15 @@ PHP_MINIT_FUNCTION(com_dotnet)
#define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)
#define COM_ERR_CONST(x) { \
#if SIZEOF_ZEND_LONG == 8
# define COM_ERR_CONST(x) { \
zend_long __tmp; \
ULongToIntPtr(x, &__tmp); \
REGISTER_LONG_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \
}
#else
# define COM_ERR_CONST COM_CONST
#endif
COM_CONST(CLSCTX_INPROC_SERVER);
COM_CONST(CLSCTX_INPROC_HANDLER);

View file

@ -0,0 +1,22 @@
--TEST--
Bug #79242 (COM error constants don't match com_exception codes)
--SKIPIF--
<?php
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
?>
--FILE--
<?php
var_dump(
DISP_E_DIVBYZERO,
DISP_E_OVERFLOW,
DISP_E_BADINDEX,
MK_E_UNAVAILABLE
);
?>
--EXPECT--
int(-2147352558)
int(-2147352566)
int(-2147352565)
int(-2147221021)