From 110daa81c3b11ec102daf4ee634e2f3d2e9c5f36 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 8 Dec 2022 21:08:38 +0100 Subject: Portability improvements for PHP8.2 --- src/sp_execute.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/sp_execute.c') diff --git a/src/sp_execute.c b/src/sp_execute.c index 5c0c939..84f6275 100644 --- a/src/sp_execute.c +++ b/src/sp_execute.c @@ -336,7 +336,11 @@ static zend_result sp_stream_open(zend_file_handle *handle) { ZEND_API zend_op_array* (*orig_zend_compile_file)(zend_file_handle* file_handle, int type) = NULL; -#if PHP_VERSION_ID >= 80000 +#if PHP_VERSION_ID >= 82000 +ZEND_API zend_op_array* (*orig_zend_compile_string)( + zend_string* source_string, const char* filename, + enum _zend_compile_position position) = NULL; +#elif PHP_VERSION_ID >= 80000 ZEND_API zend_op_array* (*orig_zend_compile_string)( zend_string* source_string, const char* filename) = NULL; #else @@ -344,7 +348,11 @@ ZEND_API zend_op_array* (*orig_zend_compile_string)(zval* source_string, char* filename) = NULL; #endif -#if PHP_VERSION_ID >= 80000 +#if PHP_VERSION_ID >= 82000 +ZEND_API zend_op_array* sp_compile_string(zend_string* source_string, + const char* filename, + enum _zend_compile_position position) { +#elif PHP_VERSION_ID >= 80000 ZEND_API zend_op_array* sp_compile_string(zend_string* source_string, const char* filename) { #else @@ -352,7 +360,11 @@ ZEND_API zend_op_array* sp_compile_string(zval* source_string, char* filename) { #endif // TODO(jvoisin) handle recursive calls to `eval` SPG(eval_source_string) = source_string; - zend_op_array* opline = orig_zend_compile_string(source_string, filename); + zend_op_array* opline = orig_zend_compile_string(source_string, filename +#if PHP_VERSION_ID >= 82000 + , position +#endif + ); if (SPCFG(sloppy).enable) { sp_sloppy_modify_opcode(opline); } -- cgit v1.3