From 96a9a122525be31c890269c51ef91dace3dce36f Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 30 Nov 2021 18:20:10 +0100 Subject: [PATCH 1/2] Fix failing 041.phpt on x64 Windows For LLP64, a `long` is 32bit, what causes 041.phpt to fail on 64bit Windows. However, as of PHP 7.0.0, integers are stored as `zend_long` by the engine, so we can fix that test failure. --- rarentry.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rarentry.c b/rarentry.c index 5e680f6..790812b 100644 --- a/rarentry.c +++ b/rarentry.c @@ -65,7 +65,11 @@ void _rar_entry_to_zval(zval *parent, char *filename; int filename_size, filename_len; +#if PHP_MAJOR_VERSION >= 7 + zend_long unp_size; /* zval stores PHP ints as zend_long, so use that here */ +#elif long unp_size; /* zval stores PHP ints as long, so use that here */ +#endif zval *parent_copy = parent; #if PHP_MAJOR_VERSION < 7 /* allocate zval on the heap */ @@ -85,7 +89,9 @@ void _rar_entry_to_zval(zval *parent, zend_update_property(rar_class_entry_ptr, obj, "rarfile", sizeof("rararch") - 1, parent_copy TSRMLS_CC); -#if ULONG_MAX > 0xffffffffUL +#if PHP_MAJOR_VERSION >= 7 && ZEND_ENABLE_ZVAL_LONG64 + unp_size = ((zend_long) entry->UnpSize) + (((zend_long) entry->UnpSizeHigh) << 32); +#elif PHP_MAJOR_VERSION < 7 && ULONG_MAX > 0xffffffffUL unp_size = ((long) entry->UnpSize) + (((long) entry->UnpSizeHigh) << 32); #else /* for 32-bit long, at least don't give negative values */ From cb72dcda9b87be873396c408be9a1f402defa0e8 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Tue, 30 Nov 2021 18:27:07 +0100 Subject: [PATCH 2/2] Fix prepocessor statement --- rarentry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rarentry.c b/rarentry.c index 790812b..5a30402 100644 --- a/rarentry.c +++ b/rarentry.c @@ -67,7 +67,7 @@ void _rar_entry_to_zval(zval *parent, filename_len; #if PHP_MAJOR_VERSION >= 7 zend_long unp_size; /* zval stores PHP ints as zend_long, so use that here */ -#elif +#else long unp_size; /* zval stores PHP ints as long, so use that here */ #endif zval *parent_copy = parent;