diff --git a/NEWS b/NEWS index a08c2d77a9c..8dbff5e134f 100644 --- a/NEWS +++ b/NEWS @@ -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) diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c index 7ff0fd0ebd5..c77d0891883 100644 --- a/ext/com_dotnet/com_extension.c +++ b/ext/com_dotnet/com_extension.c @@ -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); diff --git a/ext/com_dotnet/tests/bug79242.phpt b/ext/com_dotnet/tests/bug79242.phpt new file mode 100644 index 00000000000..46c5d8af3b7 --- /dev/null +++ b/ext/com_dotnet/tests/bug79242.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #79242 (COM error constants don't match com_exception codes) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(-2147352558) +int(-2147352566) +int(-2147352565) +int(-2147221021) +