Skip to content

Commit c07a975

Browse files
committed
Apply non-blocking corrections from JSPI pull request
1 parent 7aeebe6 commit c07a975

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

packages/php-wasm/compile/php/php7.3.patch

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,16 @@ diff --git a/php-src/main/streams/cast.c b/php-src/main/streams/cast.c
6868

6969

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

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

78+
+// Note: zend_list_free_wrapper function is required because active streams
79+
+// would otherwise cause a function signature mismatch. zend_list_free
80+
+// returns an int, while zend_rc_dtor_func_t expects a void return type.
7881
+static void zend_list_free_wrapper(zend_refcounted *p) {
7982
+ zend_resource *res = (zend_resource*)p;
8083
+ zval zv;
@@ -85,12 +88,12 @@ index c2594274dd4..42fbacf8c6e 100644
8588
static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
8689
/* IS_UNDEF */ (zend_rc_dtor_func_t)zend_empty_destroy,
8790
/* IS_NULL */ (zend_rc_dtor_func_t)zend_empty_destroy,
88-
@@ -54,7 +61,9 @@ static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
91+
@@ -54,7 +64,9 @@ static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
8992
/* IS_STRING */ (zend_rc_dtor_func_t)zend_string_destroy,
9093
/* IS_ARRAY */ (zend_rc_dtor_func_t)zend_array_destroy_wrapper,
9194
/* IS_OBJECT */ (zend_rc_dtor_func_t)zend_object_destroy_wrapper,
9295
- /* IS_RESOURCE */ (zend_rc_dtor_func_t)zend_resource_destroy_wrapper,
93-
+ // Info: zend_resource_destroy_wrapper is an alias for zend_list_free
96+
+ // Note: zend_resource_destroy_wrapper is an alias for zend_list_free
9497
+ // https://github.com/php/php-src/blob/PHP-7.3.33/Zend/zend_variables.c#L41
9598
+ /* IS_RESOURCE */ zend_list_free_wrapper,
9699
/* IS_REFERENCE */ (zend_rc_dtor_func_t)zend_reference_destroy,

packages/php-wasm/compile/php/php7.4.patch

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,24 +61,27 @@ diff --git a/php-src/ext/standard/file.c b/php-src/ext/standard/file.c
6161

6262

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

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

71+
+// Note: zend_list_free_wrapper function is required because active streams
72+
+// would otherwise cause a function signature mismatch. zend_list_free
73+
+// returns an int, while zend_rc_dtor_func_t expects a void return type.
7174
+static void zend_list_free_wrapper(zend_refcounted *p) {
72-
+ zend_resource *res = (zend_resource*)p;
73-
+ zval zv;
74-
+ ZVAL_RES(&zv, res);
75-
+ zend_list_free(&zv);
75+
+ zend_resource *res = (zend_resource*)p;
76+
+ zval zv;
77+
+ ZVAL_RES(&zv, res);
78+
+ zend_list_free(&zv);
7679
+}
7780
+
7881
static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
7982
/* IS_UNDEF */ (zend_rc_dtor_func_t)zend_empty_destroy,
8083
/* IS_NULL */ (zend_rc_dtor_func_t)zend_empty_destroy,
81-
@@ -46,7 +53,7 @@ static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
84+
@@ -46,7 +56,7 @@ static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
8285
/* IS_STRING */ (zend_rc_dtor_func_t)zend_string_destroy,
8386
/* IS_ARRAY */ (zend_rc_dtor_func_t)zend_array_destroy,
8487
/* IS_OBJECT */ (zend_rc_dtor_func_t)zend_objects_store_del,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { withXdebug } from './with-xdebug';
2+
3+
withXdebug('8.3', {});

packages/php-wasm/node/src/lib/xdebug/with-xdebug.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export async function withXdebug(
3030
if (options.onRuntimeInitialized) {
3131
options.onRuntimeInitialized(phpRuntime);
3232
}
33-
/* The extension file previously read
33+
/**
34+
* The extension file previously read
3435
* is written inside the /extensions directory
3536
*/
3637
if (

packages/php-wasm/node/vite.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default defineConfig(function () {
2323
enforce: 'pre',
2424

2525
resolveId(id: string, importer: string): any {
26-
if (id.startsWith('\0import-url:')) {
26+
if (id.startsWith('import-url:')) {
2727
return id;
2828
}
2929

@@ -32,15 +32,15 @@ export default defineConfig(function () {
3232
path.dirname(importer),
3333
id
3434
);
35-
return `\0import-url:${filepath}`;
35+
return `import-url:${filepath}`;
3636
}
3737

3838
return null;
3939
},
4040

4141
load(id: string): any {
42-
if (id.startsWith('\0import-url:')) {
43-
const encodedPath = id.slice('\0import-url:'.length);
42+
if (id.startsWith('import-url:')) {
43+
const encodedPath = id.slice('import-url:'.length);
4444
const filePath = encodedPath.replace('?url', '');
4545

4646
return {

0 commit comments

Comments
 (0)