@php-wasm/node 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs +10 -0
  2. package/index.d.ts +1 -1
  3. package/package.json +5 -5
package/index.cjs CHANGED
@@ -69937,6 +69937,16 @@ var PHPRequestHandler = class {
69937
69937
  * @returns The response.
69938
69938
  */
69939
69939
  async #dispatchToPHP(request, requestedUrl) {
69940
+ if (this.#semaphore.running > 0 && request.headers?.["x-request-issuer"] === "php") {
69941
+ console.warn(
69942
+ `Possible deadlock: Called request() before the previous request() have finished. PHP likely issued an HTTP call to itself. Normally this would lead to infinite waiting as Request 1 holds the lock that the Request 2 is waiting to acquire. That's not useful, so PHPRequestHandler will return error 502 instead.`
69943
+ );
69944
+ return new PHPResponse(
69945
+ 502,
69946
+ {},
69947
+ new TextEncoder().encode("502 Bad Gateway")
69948
+ );
69949
+ }
69940
69950
  const release = await this.#semaphore.acquire();
69941
69951
  try {
69942
69952
  this.php.addServerGlobalEntry("REMOTE_ADDR", "127.0.0.1");
package/index.d.ts CHANGED
@@ -216,7 +216,7 @@ export interface IsomorphicLocalPHP extends RequestHandler {
216
216
  * @param key - The name of the constant.
217
217
  * @param value - The value of the constant.
218
218
  */
219
- defineConstant(key: string, value: string | number | null): void;
219
+ defineConstant(key: string, value: boolean | string | number | null): void;
220
220
  /**
221
221
  * Adds an event listener for a PHP event.
222
222
  * @param eventType - The type of event to listen for.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@php-wasm/node",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "PHP.wasm for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  "license": "GPL-2.0-or-later",
29
29
  "main": "index.cjs",
30
30
  "types": "index.d.ts",
31
- "gitHead": "3f137306ec8e3b10ec0674a1fe69ee43349edb4a",
31
+ "gitHead": "3c0de0d0847c3550a75a026bef9724eac421afbf",
32
32
  "engines": {
33
33
  "node": ">=18.18.2",
34
34
  "npm": ">=8.11.0"
@@ -38,8 +38,8 @@
38
38
  "express": "4.18.2",
39
39
  "ws": "8.13.0",
40
40
  "yargs": "17.7.2",
41
- "@php-wasm/node-polyfills": "0.6.0",
42
- "@php-wasm/universal": "0.6.0",
43
- "@php-wasm/util": "0.6.0"
41
+ "@php-wasm/node-polyfills": "0.6.2",
42
+ "@php-wasm/universal": "0.6.2",
43
+ "@php-wasm/util": "0.6.2"
44
44
  }
45
45
  }