From f24aa1084ee50d8e0e290b4e24b9dc236350cbe9 Mon Sep 17 00:00:00 2001 From: Ben Fuhrmannek Date: Tue, 21 Feb 2017 18:11:37 +0100 Subject: PHP 7.1 compatibility - #16 --- .travis.yml | 1 + ex_imp.c | 2 +- log.c | 4 ++++ php_suhosin7.h | 4 ++-- session.c | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index bfad839..213b493 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ group: edge php: - 7.0 + - 7.1 env: - CC=gcc-4.8 CFLAGS="" diff --git a/ex_imp.c b/ex_imp.c index 7ea0f29..4a48aa5 100644 --- a/ex_imp.c +++ b/ex_imp.c @@ -201,7 +201,7 @@ PHP_FUNCTION(suhosin_extract) if (var_exists && ZSTR_LEN(var_name) == sizeof("GLOBALS")-1 && !strcmp(ZSTR_VAL(var_name), "GLOBALS")) { break; } - if (var_exists && ZSTR_LEN(var_name) == sizeof("this")-1 && !strcmp(ZSTR_VAL(var_name), "this") && EG(scope) && ZSTR_LEN(EG(scope)->name) != 0) { + if (var_exists && ZSTR_LEN(var_name) == sizeof("this")-1 && !strcmp(ZSTR_VAL(var_name), "this") /* && EG(scope) && ZSTR_LEN(EG(scope)->name) != 0 */) { break; } ZVAL_STR_COPY(&final_name, var_name); diff --git a/log.c b/log.c index fe6d824..936418a 100644 --- a/log.c +++ b/log.c @@ -284,7 +284,11 @@ log_sapi: /* SAPI Logging activated? */ // SDEBUG("(suhosin_log) log_syslog: %ld - log_sapi: %ld - log_script: %ld - log_phpscript: %ld", SUHOSIN7_G(log_syslog), SUHOSIN7_G(log_sapi), SUHOSIN7_G(log_script), SUHOSIN7_G(log_phpscript)); if (sapi_module.log_message && ((SUHOSIN7_G(log_sapi)|S_INTERNAL) & loglevel)!=0) { +#if PHP_VERSION_ID < 70100 sapi_module.log_message(buf); +#else /* PHP >= 7.1 */ + sapi_module.log_message(buf, -1); +#endif } if ((SUHOSIN7_G(log_stdout) & loglevel)!=0) { fprintf(stdout, "%s\n", buf); diff --git a/php_suhosin7.h b/php_suhosin7.h index 1398a36..fb9cf90 100644 --- a/php_suhosin7.h +++ b/php_suhosin7.h @@ -23,8 +23,8 @@ extern zend_module_entry suhosin7_module_entry; #define SUHOSIN7_EXT_VERSION "0.10.0dev" -#if PHP_VERSION_ID < 70000 | PHP_VERSION_ID >= 70100 -#error Suhosin7 works with PHP 7.0 only! Looking for Suhosin for PHP 5.x? Take a look at https://www.suhosin.org/ +#if PHP_VERSION_ID < 70000 | PHP_VERSION_ID >= 70200 +#error Suhosin7 works with PHP 7.0 and 7.1 only! Looking for Suhosin for PHP 5.x? Take a look at https://www.suhosin.org/ #endif #ifdef PHP_WIN32 diff --git a/session.c b/session.c index 2abe2ec..d401da4 100644 --- a/session.c +++ b/session.c @@ -265,7 +265,7 @@ void suhosin_hook_session() suhosin_hook_session_module(); -#if HAVE_DEV_URANDOM +#if HAVE_DEV_URANDOM && PHP_VERSION_ID < 70100 /* increase session identifier entropy */ if (SESSION_G(entropy_length) == 0 || SESSION_G(entropy_file) == NULL) { SESSION_G(entropy_length) = 16; -- cgit v1.3