summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2022-12-10 11:36:04 +0100
committerjvoisin2022-12-10 11:43:07 +0100
commitc016fa1a7ce11e657f215dd69deac59d973d6dd9 (patch)
tree5beeff849ea3bf85615e725fffc0f72344afa3be
parent110daa81c3b11ec102daf4ee634e2f3d2e9c5f36 (diff)
Even more changes to accomodate PHP8.2
-rw-r--r--src/sp_execute.c6
-rw-r--r--src/sp_ini.c6
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) {
336 336
337ZEND_API zend_op_array* (*orig_zend_compile_file)(zend_file_handle* file_handle, 337ZEND_API zend_op_array* (*orig_zend_compile_file)(zend_file_handle* file_handle,
338 int type) = NULL; 338 int type) = NULL;
339#if PHP_VERSION_ID >= 82000 339#if PHP_VERSION_ID >= 80200
340ZEND_API zend_op_array* (*orig_zend_compile_string)( 340ZEND_API zend_op_array* (*orig_zend_compile_string)(
341 zend_string* source_string, const char* filename, 341 zend_string* source_string, const char* filename,
342 enum _zend_compile_position position) = NULL; 342 enum _zend_compile_position position) = NULL;
@@ -348,7 +348,7 @@ ZEND_API zend_op_array* (*orig_zend_compile_string)(zval* source_string,
348 char* filename) = NULL; 348 char* filename) = NULL;
349#endif 349#endif
350 350
351#if PHP_VERSION_ID >= 82000 351#if PHP_VERSION_ID >= 80200
352ZEND_API zend_op_array* sp_compile_string(zend_string* source_string, 352ZEND_API zend_op_array* sp_compile_string(zend_string* source_string,
353 const char* filename, 353 const char* filename,
354 enum _zend_compile_position position) { 354 enum _zend_compile_position position) {
@@ -361,7 +361,7 @@ ZEND_API zend_op_array* sp_compile_string(zval* source_string, char* filename) {
361 // TODO(jvoisin) handle recursive calls to `eval` 361 // TODO(jvoisin) handle recursive calls to `eval`
362 SPG(eval_source_string) = source_string; 362 SPG(eval_source_string) = source_string;
363 zend_op_array* opline = orig_zend_compile_string(source_string, filename 363 zend_op_array* opline = orig_zend_compile_string(source_string, filename
364#if PHP_VERSION_ID >= 82000 364#if PHP_VERSION_ID >= 80200
365 , position 365 , position
366#endif 366#endif
367 ); 367 );
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
57 // we have a new_value. 57 // we have a new_value.
58 58
59 if (entry->min || entry->max) { 59 if (entry->min || entry->max) {
60#if PHP_VERSION_ID >= 80200
61 zend_long lvalue = ZEND_STRTOL(ZSTR_VAL(new_value), NULL, 0);
62 if ((entry->min && ZEND_STRTOL(ZSTR_VAL(entry->min), NULL, 0) > lvalue) ||
63 (entry->max && ZEND_STRTOL(ZSTR_VAL(entry->max), NULL, 0) < lvalue)) {
64#else
60 zend_long lvalue = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value)); 65 zend_long lvalue = zend_atol(ZSTR_VAL(new_value), ZSTR_LEN(new_value));
61 if ((entry->min && zend_atol(ZSTR_VAL(entry->min), ZSTR_LEN(entry->min)) > lvalue) || 66 if ((entry->min && zend_atol(ZSTR_VAL(entry->min), ZSTR_LEN(entry->min)) > lvalue) ||
62 (entry->max && zend_atol(ZSTR_VAL(entry->max), ZSTR_LEN(entry->max)) < lvalue)) { 67 (entry->max && zend_atol(ZSTR_VAL(entry->max), ZSTR_LEN(entry->max)) < lvalue)) {
68#endif
63 sp_log_ini_check_violation("%s", (entry->msg ? ZSTR_VAL(entry->msg) : "INI value out of range")); 69 sp_log_ini_check_violation("%s", (entry->msg ? ZSTR_VAL(entry->msg) : "INI value out of range"));
64 return simulation; 70 return simulation;
65 } 71 }