diff --git a/ext/com_dotnet/com_handlers.c b/ext/com_dotnet/com_handlers.c index fb4af4efec2c4..4b8fd09a453fb 100644 --- a/ext/com_dotnet/com_handlers.c +++ b/ext/com_dotnet/com_handlers.c @@ -453,7 +453,11 @@ static int com_object_cast(zend_object *readobj, zval *writeobj, int type) switch(type) { case IS_LONG: case _IS_NUMBER: - vt = VT_INT; +#if SIZEOF_ZEND_LONG == 4 + vt = VT_I4; +#else + vt = VT_I8; +#endif break; case IS_DOUBLE: vt = VT_R8; diff --git a/ext/com_dotnet/tests/gh8778.phpt b/ext/com_dotnet/tests/gh8778.phpt new file mode 100644 index 0000000000000..968804b7c5c81 --- /dev/null +++ b/ext/com_dotnet/tests/gh8778.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug GH-8778 (Integer arithmethic with large number variants fails) +--SKIPIF-- + +--FILE-- + +--EXPECT-- +int(4294967296) +int(4294967297)