From 93cc22bfb57fc881889165ead1adc94dda30dfc4 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 24 Oct 2019 20:51:56 +0200 Subject: Improve a bit the compatibility with php8 - Apparently, TSRMLS_C and TSRMLS_FETCH aren't defined anymore, so we have to manually define them to nothing - PHP8 constified a bit some strings, which is great, so we should do the same to avoid warnings --- src/php_snuffleupagus.h | 4 ++++ src/sp_sloppy.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/php_snuffleupagus.h b/src/php_snuffleupagus.h index 1c45653..0141a87 100644 --- a/src/php_snuffleupagus.h +++ b/src/php_snuffleupagus.h @@ -53,6 +53,10 @@ #if PHP_VERSION_ID < 70200 typedef void (*zif_handler)(INTERNAL_FUNCTION_PARAMETERS); #endif +#if PHP_VERSION_ID >= 80000 +#define TSRMLS_FETCH() +#define TSRMLS_C +#endif #include "sp_pcre_compat.h" #include "sp_list.h" diff --git a/src/sp_sloppy.c b/src/sp_sloppy.c index 5837783..88052bb 100644 --- a/src/sp_sloppy.c +++ b/src/sp_sloppy.c @@ -2,8 +2,13 @@ ZEND_API zend_op_array* (*orig_zend_compile_file)(zend_file_handle* file_handle, int type) = NULL; +#if PHP_VERSION_ID >= 80000 +ZEND_API zend_op_array* (*orig_zend_compile_string)(zval* source_string, + const char* filename) = NULL; +#else ZEND_API zend_op_array* (*orig_zend_compile_string)(zval* source_string, char* filename) = NULL; +#endif static void modify_opcode(zend_op_array* opline) { if (NULL != opline) { -- cgit v1.3