Skip to content

[ php-wasm ] Add xdebug shared extension to @php-wasm/node ASYNCIFY #2326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/meta/src/node-es-module-loader/loader.mts
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ export async function load(
urlObj.search = '';
return {
format: 'module',
source: `export default ${JSON.stringify(urlObj.href)};`,
// TODO: Consider which is preferable and discuss with @adamziel.
// He implemented the pathname version.
//source: `export default ${JSON.stringify(urlObj.pathname)};`,
source: `export default ${JSON.stringify(urlObj.pathname)};`,
// As mentioned in
// https://github.com/WordPress/wordpress-playground/pull/2318
// using pathname is preferred over href.
shortCircuit: true,
};
}
Expand Down
4 changes: 4 additions & 0 deletions packages/php-wasm/compile/php/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -1644,6 +1644,8 @@ RUN export ASYNCIFY_IMPORTS=$'[\n\
"zend_execute_script",\
"zend_execute_scripts",\
"zend_execute",\
"zend_extension_statement_handler",\
"ZEND_EXT_STMT_SPEC_HANDLER",\
"ZEND_FE_FETCH_R_SPEC_VAR_HANDLER",\
"zend_fe_reset_iterator",\
"ZEND_FE_RESET_R_SPEC_VAR_HANDLER",\
Expand Down Expand Up @@ -1724,6 +1726,8 @@ RUN export ASYNCIFY_IMPORTS=$'[\n\
"zend_objects_store_del_ref",\
"zend_objects_store_del",\
"zend_objects_store_free_object_storage",\
"zend_observer_fcall_begin_prechecked",\
"zend_observer_fcall_begin",\
"zend_observer_fcall_end",\
"zend_parse_arg_number_or_str_slow",\
"zend_parse_arg_str_weak",\
Expand Down
11 changes: 7 additions & 4 deletions packages/php-wasm/compile/php/php7.3.patch
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ diff --git a/php-src/main/streams/cast.c b/php-src/main/streams/cast.c


diff --git a/php-src/Zend/zend_variables.c b/php-src/Zend/zend_variables.c
index c2594274dd4..42fbacf8c6e 100644
index c2594274dd4..2c3a01ece57 100644
--- a/php-src/Zend/zend_variables.c
+++ b/php-src/Zend/zend_variables.c
@@ -44,6 +44,13 @@ static void ZEND_FASTCALL zend_ast_ref_destroy_wrapper(zend_ast_ref *ast);
@@ -44,6 +44,16 @@ static void ZEND_FASTCALL zend_ast_ref_destroy_wrapper(zend_ast_ref *ast);

typedef void (ZEND_FASTCALL *zend_rc_dtor_func_t)(zend_refcounted *p);

+// Note: zend_list_free_wrapper function is required because active streams
+// would otherwise cause a function signature mismatch. zend_list_free
+// returns an int, while zend_rc_dtor_func_t expects a void return type.
+static void zend_list_free_wrapper(zend_refcounted *p) {
+ zend_resource *res = (zend_resource*)p;
+ zval zv;
Expand All @@ -85,12 +88,12 @@ index c2594274dd4..42fbacf8c6e 100644
static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
/* IS_UNDEF */ (zend_rc_dtor_func_t)zend_empty_destroy,
/* IS_NULL */ (zend_rc_dtor_func_t)zend_empty_destroy,
@@ -54,7 +61,9 @@ static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
@@ -54,7 +64,9 @@ static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
/* IS_STRING */ (zend_rc_dtor_func_t)zend_string_destroy,
/* IS_ARRAY */ (zend_rc_dtor_func_t)zend_array_destroy_wrapper,
/* IS_OBJECT */ (zend_rc_dtor_func_t)zend_object_destroy_wrapper,
- /* IS_RESOURCE */ (zend_rc_dtor_func_t)zend_resource_destroy_wrapper,
+ // Info: zend_resource_destroy_wrapper is an alias for zend_list_free
+ // Note: zend_resource_destroy_wrapper is an alias for zend_list_free
+ // https://github.com/php/php-src/blob/PHP-7.3.33/Zend/zend_variables.c#L41
+ /* IS_RESOURCE */ zend_list_free_wrapper,
/* IS_REFERENCE */ (zend_rc_dtor_func_t)zend_reference_destroy,
Expand Down
17 changes: 10 additions & 7 deletions packages/php-wasm/compile/php/php7.4.patch
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,27 @@ diff --git a/php-src/ext/standard/file.c b/php-src/ext/standard/file.c


diff --git a/php-src/Zend/zend_variables.c b/php-src/Zend/zend_variables.c
index 810866a1be2..fdd1c80fea5 100644
index 810866a1be2..0cc2a95dcf2 100644
--- a/php-src/Zend/zend_variables.c
+++ b/php-src/Zend/zend_variables.c
@@ -36,6 +36,13 @@ static void ZEND_FASTCALL zend_empty_destroy(zend_reference *ref);
@@ -36,6 +36,16 @@ static void ZEND_FASTCALL zend_empty_destroy(zend_reference *ref);

typedef void (ZEND_FASTCALL *zend_rc_dtor_func_t)(zend_refcounted *p);

+// Note: zend_list_free_wrapper function is required because active streams
+// would otherwise cause a function signature mismatch. zend_list_free
+// returns an int, while zend_rc_dtor_func_t expects a void return type.
+static void zend_list_free_wrapper(zend_refcounted *p) {
+ zend_resource *res = (zend_resource*)p;
+ zval zv;
+ ZVAL_RES(&zv, res);
+ zend_list_free(&zv);
+ zend_resource *res = (zend_resource*)p;
+ zval zv;
+ ZVAL_RES(&zv, res);
+ zend_list_free(&zv);
+}
+
static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
/* IS_UNDEF */ (zend_rc_dtor_func_t)zend_empty_destroy,
/* IS_NULL */ (zend_rc_dtor_func_t)zend_empty_destroy,
@@ -46,7 +53,7 @@ static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
@@ -46,7 +56,7 @@ static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
/* IS_STRING */ (zend_rc_dtor_func_t)zend_string_destroy,
/* IS_ARRAY */ (zend_rc_dtor_func_t)zend_array_destroy,
/* IS_OBJECT */ (zend_rc_dtor_func_t)zend_objects_store_del,
Expand Down
Loading