From c016fa1a7ce11e657f215dd69deac59d973d6dd9 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 10 Dec 2022 11:36:04 +0100 Subject: Even more changes to accomodate PHP8.2 --- src/sp_execute.c | 6 +++--- src/sp_ini.c | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/sp_execute.c b/src/sp_execute.c index 84f6275..300d05c 100644 --- a/src/sp_execute.c +++ b/src/sp_execute.c @@ -336,7 +336,7 @@ 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 >= 82000 +#if PHP_VERSION_ID >= 80200 ZEND_API zend_op_array* (*orig_zend_compile_string)( zend_string* source_string, const char* filename, enum _zend_compile_position position) = NULL; @@ -348,7 +348,7 @@ ZEND_API zend_op_array* (*orig_zend_compile_string)(zval* source_string, char* filename) = NULL; #endif -#if PHP_VERSION_ID >= 82000 +#if PHP_VERSION_ID >= 80200 ZEND_API zend_op_array* sp_compile_string(zend_string* source_string, const char* filename, enum _zend_compile_position position) { @@ -361,7 +361,7 @@ ZEND_API zend_op_array* sp_compile_string(zval* source_string, char* filename) { // TODO(jvoisin) handle recursive calls to `eval` SPG(eval_source_string) = source_string; zend_op_array* opline = orig_zend_compile_string(source_string, filename -#if PHP_VERSION_ID >= 82000 +#if PHP_VERSION_ID >= 80200 , position #endif ); diff --git a/src/sp_ini.c b/src/sp_ini.c index ed23fb7..7b22012 100644 --- a/src/sp_ini.c +++ b/src/sp_ini.c @@ -57,9 +57,15 @@ static bool /* success */ sp_ini_check(zend_string *const restrict varname, zend // we have a new_value. if (entry->min || entry->max) { +#if PHP_VERSION_ID >= 80200 + zend_long lvalue = ZEND_STRTOL(ZSTR_VAL(new_value), NULL, 0); + if ((entry->min && ZEND_STRTOL(ZSTR_VAL(entry->min), NULL, 0) > lvalue) || + (entry->max && ZEND_STRTOL(ZSTR_VAL(entry->max), NULL, 0) < lvalue)) { +#else zend_long lvalue = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value)); if ((entry->min && zend_atol(ZSTR_VAL(entry->min), ZSTR_LEN(entry->min)) > lvalue) || (entry->max && zend_atol(ZSTR_VAL(entry->max), ZSTR_LEN(entry->max)) < lvalue)) { +#endif sp_log_ini_check_violation("%s", (entry->msg ? ZSTR_VAL(entry->msg) : "INI value out of range")); return simulation; } -- cgit v1.3