Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8 compatibility on Windows #20

Open
Jan-E opened this issue Dec 3, 2020 · 1 comment
Open

PHP 8 compatibility on Windows #20

Jan-E opened this issue Dec 3, 2020 · 1 comment

Comments

@Jan-E
Copy link

Jan-E commented Dec 3, 2020

Is PHP8 compatibility in the planning? pecl-compat/compat.h should at least have this change:

diff --git a/pecl-compat/compat.h b/pecl-compat/compat.h
index eccc0b7..185cef8 100644
--- a/pecl-compat/compat.h
+++ b/pecl-compat/compat.h
@@ -83,7 +83,7 @@
 #	include <sys/stat.h>
 #endif
 
-#ifdef PHP_WIN32
+#if defined(_MSC_VER) && _MSC_VER < 1920
 #include <win32/php_stdint.h>
 #else
 #include <inttypes.h>

Ratio: win32/php_stdint.h does not exist anymore in PHP8, but the VS16 compiler does provide a inttypes.h. So we check if we are using a MSVC compiler and if it is a lower version than Visual Studio 2019 (or VS16).

@Jan-E
Copy link
Author

Jan-E commented Dec 3, 2020

There is also the issue that the TSRMLS macros have been removed in PHP8. They already did not do anything at all in PHP7, but they are gone completely now. A crude way to deal with this is just to define them:

diff --git a/pecl-compat/compat.h b/pecl-compat/compat.h
index eccc0b7..c37263b 100644
--- a/pecl-compat/compat.h
+++ b/pecl-compat/compat.h
@@ -83,12 +83,22 @@
 #	include <sys/stat.h>
 #endif
 
-#ifdef PHP_WIN32
+#if defined(_MSC_VER) && _MSC_VER < 1920
 #include <win32/php_stdint.h>
 #else
 #include <inttypes.h>
 #endif
 
+#ifndef TSRMLS_DC
+#define TSRMLS_DC
+#endif
+#ifndef TSRMLS_CC
+#define TSRMLS_CC
+#endif
+#ifndef TSRMLS_C
+#define TSRMLS_C
+#endif
+
 #if ZEND_EXTENSION_API_NO >= PHP_5_6_X_API_NO
 #include "zend_virtual_cwd.h"
 #else

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant