File tree Expand file tree Collapse file tree
packages/php-wasm/compile-extension
tests/fixtures/external-abi Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,5 +110,22 @@ if [ -x /root/emsdk/upstream/bin/wasm-opt ]; then
110110 -o " $module_path "
111111fi
112112
113+ node --input-type=module - " $module_path " << 'EOF '
114+ import { readFile } from 'node:fs/promises';
115+
116+ const modulePath = process.argv[2];
117+ const module = new WebAssembly.Module(await readFile(modulePath));
118+ const hasGetModule = WebAssembly.Module.exports(module).some(
119+ ({ kind, name }) => kind === 'function' && name === 'get_module'
120+ );
121+
122+ if (!hasGetModule) {
123+ throw new Error(
124+ `${modulePath} does not export PHP's get_module() entry point. ` +
125+ 'PHP extensions must include config.h and call ZEND_GET_MODULE().'
126+ );
127+ }
128+ EOF
129+
113130mkdir -p /out
114131cp " $module_path " " /out/${ARTIFACT_FILENAME} "
Original file line number Diff line number Diff line change 1+ #ifdef HAVE_CONFIG_H
2+ #include "config.h"
3+ #endif
4+
15#include "php.h"
26#include "ext/standard/php_password.h"
37#include <stdio.h>
@@ -43,5 +47,8 @@ zend_module_entry external_abi_module_entry = {
4347};
4448
4549#ifdef COMPILE_DL_EXTERNAL_ABI
50+ #ifdef ZTS
51+ ZEND_TSRMLS_CACHE_DEFINE ()
52+ #endif
4653ZEND_GET_MODULE (external_abi )
4754#endif
You can’t perform that action at this time.
0 commit comments