Skip to content

Commit ee35972

Browse files
authored
[PHP] Add TSRMLS_CC fallback defines for PHP versions above 7 (#3512)
## Motivation for the change, related issues [Add PHP 5.2 WebAssembly builds and runtime support](#3501) added `TSRMLS_CC` macros to `dns_polyfill` and `post_message_to_js` for PHP 5.x compatibility, but these macros don't exist in PHP 7+. This breaks recompilation of PHP.wasm for all PHP versions 7.0 through 8.5. ## Implementation details Added empty `TSRMLS_CC` fallback defines to `dns_polyfill.c` and `post_message_to_js.c` ## Testing Instructions (or ideally a Blueprint) - [x] `nx run php-wasm-node:recompile-php:jspi` - [x] `nx run php-wasm-node:recompile-php:asyncify` - [x] `nx run php-wasm-web:recompile-php:jspi` - [x] `nx run php-wasm-web:recompile-php:asyncify`
1 parent 6011949 commit ee35972

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎packages/php-wasm/compile/php-post-message-to-js/post_message_to_js.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
#define PHP_FE_END {NULL, NULL, NULL}
99
#endif
1010

11+
/* TSRMLS macros were removed in PHP 7; provide empty fallbacks */
12+
#ifndef TSRMLS_CC
13+
#define TSRMLS_CC
14+
#endif
15+
1116
/**
1217
* Provided by php_wasm.c:
1318
*/
@@ -83,4 +88,4 @@ zend_module_entry post_message_to_js_module_entry = {
8388
ZEND_TSRMLS_CACHE_DEFINE()
8489
#endif
8590
ZEND_GET_MODULE(post_message_to_js)
86-
#endif
91+
#endif

‎packages/php-wasm/compile/php-wasm-dns-polyfill/dns_polyfill.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
#define ZEND_FE_END {NULL, NULL, NULL}
1111
#endif
1212

13+
/* TSRMLS macros were removed in PHP 7; provide empty fallbacks */
14+
#ifndef TSRMLS_CC
15+
#define TSRMLS_CC
16+
#endif
17+
1318
#ifdef HAVE_SYS_SOCKET_H
1419
#include <sys/socket.h>
1520
#endif
@@ -329,4 +334,4 @@ zend_module_entry dns_polyfill_module_entry = {
329334
PHP_MINFO(dns_polyfill), /* PHP_MINFO - Module info */
330335
PHP_DNS_POLYFILL_VERSION, /* Version */
331336
STANDARD_MODULE_PROPERTIES};
332-
/* }}} */
337+
/* }}} */

0 commit comments

Comments
 (0)