Skip to content

Commit 0e02059

Browse files
author
Martin Köditz
authored
Fixed compiling problems in PHP 8 on Windows
Since PHP 8 we have troubles building sources on Windows, because of missing TSRMLS_FETCH_FROM_CTX and TSRMLS_SET_CTX symbols.
1 parent bb23cd0 commit 0e02059

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

ibase_events.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
+----------------------------------------------------------------------+
3-
| PHP Version 7 |
3+
| PHP Version 7, 8 |
44
+----------------------------------------------------------------------+
55
| Copyright (c) The PHP Group |
66
+----------------------------------------------------------------------+
@@ -13,6 +13,7 @@
1313
| [email protected] so we can mail you a copy immediately. |
1414
+----------------------------------------------------------------------+
1515
| Authors: Ard Biesheuvel <[email protected]> |
16+
| Martin Köditz <[email protected]> |
1617
+----------------------------------------------------------------------+
1718
*/
1819

@@ -22,6 +23,18 @@
2223

2324
#include "php.h"
2425

26+
/*
27+
* Since PHP 8 we have troubles building sources on Windows,
28+
* because of missing TSRMLS_FETCH_FROM_CTX and TSRMLS_SET_CTX symbols.
29+
*/
30+
#if PHP_VERSION_ID >= 80000
31+
# define FBIRD_TSRMLS_FETCH_FROM_CTX(user_data)
32+
# define FBIRD_TSRMLS_SET_CTX(user_data)
33+
#else
34+
# define FBIRD_TSRMLS_FETCH_FROM_CTX(user_data) TSRMLS_FETCH_FROM_CTX(user_data)
35+
# define FBIRD_TSRMLS_SET_CTX(user_data) TSRMLS_SET_CTX(user_data)
36+
#endif
37+
2538
#if HAVE_IBASE
2639

2740
#include "php_interbase.h"
@@ -201,7 +214,7 @@ static isc_callback _php_ibase_callback(ibase_event *event, /* {{{ */
201214
#endif
202215
{
203216
/* this function is called asynchronously by the Interbase client library. */
204-
TSRMLS_FETCH_FROM_CTX(event->thread_ctx);
217+
FBIRD_TSRMLS_FETCH_FROM_CTX(event->thread_ctx);
205218

206219
/**
207220
* The callback function is called when the event is first registered and when the event
@@ -326,7 +339,7 @@ PHP_FUNCTION(ibase_set_event_handler)
326339

327340
/* allocate the event resource */
328341
event = (ibase_event *) safe_emalloc(sizeof(ibase_event), 1, 0);
329-
TSRMLS_SET_CTX(event->thread_ctx);
342+
FBIRD_TSRMLS_SET_CTX(event->thread_ctx);
330343
event->link_res = link_res;
331344
GC_ADDREF(link_res);
332345
event->link = ib_link;

0 commit comments

Comments
 (0)