Skip to content

Commit 21ac95f

Browse files
committed
PHP: compatibility with 8.0.0 Beta 1.
This closes #441 PR on GitHub.
1 parent 09685e2 commit 21ac95f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/nxt_php_sapi.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
#if PHP_VERSION_ID >= 70000
2929
#define NXT_PHP7 1
3030
#endif
31+
#if PHP_VERSION_ID >= 80000
32+
#define NXT_PHP8 1
33+
#endif
3134

3235
/* PHP 8 */
3336
#ifndef TSRMLS_CC
@@ -61,7 +64,9 @@ typedef struct {
6164
} nxt_php_run_ctx_t;
6265

6366

64-
#ifdef NXT_PHP7
67+
#if NXT_PHP8
68+
typedef int (*nxt_php_disable_t)(const char *p, size_t size);
69+
#elif NXT_PHP7
6570
typedef int (*nxt_php_disable_t)(char *p, size_t size);
6671
#else
6772
typedef int (*nxt_php_disable_t)(char *p, uint TSRMLS_DC);
@@ -105,11 +110,15 @@ nxt_inline void nxt_php_set_str(nxt_unit_request_info_t *req, const char *name,
105110
static void nxt_php_set_cstr(nxt_unit_request_info_t *req, const char *name,
106111
const char *str, uint32_t len, zval *track_vars_array TSRMLS_DC);
107112
static void nxt_php_register_variables(zval *track_vars_array TSRMLS_DC);
113+
#if NXT_PHP8
114+
static void nxt_php_log_message(const char *message, int syslog_type_int);
115+
#else
108116
#ifdef NXT_HAVE_PHP_LOG_MESSAGE_WITH_SYSLOG_TYPE
109117
static void nxt_php_log_message(char *message, int syslog_type_int);
110118
#else
111119
static void nxt_php_log_message(char *message TSRMLS_DC);
112120
#endif
121+
#endif
113122

114123
#ifdef NXT_PHP7
115124
static size_t nxt_php_unbuffered_write(const char *str,
@@ -1240,13 +1249,18 @@ nxt_php_set_cstr(nxt_unit_request_info_t *req, const char *name,
12401249
}
12411250

12421251

1252+
#if NXT_PHP8
1253+
static void
1254+
nxt_php_log_message(const char *message, int syslog_type_int)
1255+
#else
12431256
#ifdef NXT_HAVE_PHP_LOG_MESSAGE_WITH_SYSLOG_TYPE
12441257
static void
12451258
nxt_php_log_message(char *message, int syslog_type_int)
12461259
#else
12471260
static void
12481261
nxt_php_log_message(char *message TSRMLS_DC)
12491262
#endif
1263+
#endif
12501264
{
12511265
nxt_php_run_ctx_t *ctx;
12521266

0 commit comments

Comments
 (0)