diff options
author | Valentin Bartenev <vbart@nginx.com> | 2020-10-06 18:12:05 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2020-10-06 18:12:05 +0300 |
commit | 2821b3347c026ae171228146c5ccd0bd7408358f (patch) | |
tree | 9d2ce042131e0ec239f669f35eab971e952a3d40 /src | |
parent | 6ec0ff35964c7805712d978625949f72ff5a63bc (diff) | |
download | unit-2821b3347c026ae171228146c5ccd0bd7408358f.tar.gz unit-2821b3347c026ae171228146c5ccd0bd7408358f.tar.bz2 |
PHP: compatibility with 8.0.0 RC1.
This closes #474 PR on GitHub.
Diffstat (limited to 'src')
-rw-r--r-- | src/nxt_php_sapi.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c index de329ad7..234ceef8 100644 --- a/src/nxt_php_sapi.c +++ b/src/nxt_php_sapi.c @@ -88,6 +88,9 @@ static void nxt_php_set_options(nxt_task_t *task, nxt_conf_value_t *options, int type); static nxt_int_t nxt_php_alter_option(nxt_str_t *name, nxt_str_t *value, int type); +#ifdef NXT_PHP8 +static void nxt_php_disable_functions(nxt_str_t *str); +#endif static void nxt_php_disable(nxt_task_t *task, const char *type, nxt_str_t *value, char **ptr, nxt_php_disable_t disable); @@ -589,9 +592,13 @@ nxt_php_set_options(nxt_task_t *task, nxt_conf_value_t *options, int type) } if (nxt_str_eq(&name, "disable_functions", 17)) { +#ifdef NXT_PHP8 + nxt_php_disable_functions(&value); +#else nxt_php_disable(task, "function", &value, &PG(disable_functions), zend_disable_function); +#endif continue; } @@ -680,6 +687,29 @@ nxt_php_alter_option(nxt_str_t *name, nxt_str_t *value, int type) #endif +#ifdef NXT_PHP8 + +static void +nxt_php_disable_functions(nxt_str_t *str) +{ + char *p; + + p = nxt_malloc(str->length + 1); + if (nxt_slow_path(p == NULL)) { + return; + } + + nxt_memcpy(p, str->start, str->length); + p[str->length] = '\0'; + + zend_disable_functions(p); + + nxt_free(p); +} + +#endif + + static void nxt_php_disable(nxt_task_t *task, const char *type, nxt_str_t *value, char **ptr, nxt_php_disable_t disable) |