Skip to content

Commit 7f86f99

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #79242: COM error constants don't match com_exception codes
2 parents cd5591a + b9738f5 commit 7f86f99

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ PHP NEWS
66
- COM:
77
. Fixed bug #66322 (COMPersistHelper::SaveToFile can save to wrong location).
88
(cmb)
9+
. Fixed bug #79242 (COM error constants don't match com_exception codes on
10+
x86). (cmb)
911

1012
- CURL:
1113
. Fixed bug #79019 (Copied cURL handles upload empty file). (cmb)

ext/com_dotnet/com_extension.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,15 @@ PHP_MINIT_FUNCTION(com_dotnet)
341341

342342
#define COM_CONST(x) REGISTER_LONG_CONSTANT(#x, x, CONST_CS|CONST_PERSISTENT)
343343

344-
#define COM_ERR_CONST(x) { \
344+
#if SIZEOF_ZEND_LONG == 8
345+
# define COM_ERR_CONST(x) { \
345346
zend_long __tmp; \
346347
ULongToIntPtr(x, &__tmp); \
347348
REGISTER_LONG_CONSTANT(#x, __tmp, CONST_CS|CONST_PERSISTENT); \
348349
}
350+
#else
351+
# define COM_ERR_CONST COM_CONST
352+
#endif
349353

350354
COM_CONST(CLSCTX_INPROC_SERVER);
351355
COM_CONST(CLSCTX_INPROC_HANDLER);

ext/com_dotnet/tests/bug79242.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
Bug #79242 (COM error constants don't match com_exception codes)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('com_dotnet')) die('skip com_dotnet extension not available');
6+
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only");
7+
?>
8+
--FILE--
9+
<?php
10+
var_dump(
11+
DISP_E_DIVBYZERO,
12+
DISP_E_OVERFLOW,
13+
DISP_E_BADINDEX,
14+
MK_E_UNAVAILABLE
15+
);
16+
?>
17+
--EXPECT--
18+
int(-2147352558)
19+
int(-2147352566)
20+
int(-2147352565)
21+
int(-2147221021)
22+

0 commit comments

Comments
 (0)