@php-wasm/node 2.0.16 → 2.0.19

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.
@@ -6,10 +6,10 @@ const require = createRequire(import.meta.url);
6
6
  // Note: The path module is currently needed by code injected by the php-wasm Dockerfile.
7
7
  import path from 'path';
8
8
 
9
- const dependencyFilename = path.join(__dirname, '8_3_24', 'php_8_3.wasm');
9
+ const dependencyFilename = path.join(__dirname, '8_3_25', 'php_8_3.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 26573878;
12
- const phpVersionString = '8.3.24';
11
+ export const dependenciesTotalSize = 26575785;
12
+ const phpVersionString = '8.3.25';
13
13
  export function init(RuntimeName, PHPLoader) {
14
14
  // The rest of the code comes from the built php.js file and esm-suffix.js
15
15
  // include: shell.js
@@ -831,7 +831,7 @@ export function init(RuntimeName, PHPLoader) {
831
831
  },
832
832
  };
833
833
 
834
- var ___heap_base = 13876608;
834
+ var ___heap_base = 13876672;
835
835
 
836
836
  var alignMemory = (size, alignment) => {
837
837
  return Math.ceil(size / alignment) * alignment;
@@ -1786,13 +1786,13 @@ export function init(RuntimeName, PHPLoader) {
1786
1786
  1024
1787
1787
  );
1788
1788
 
1789
- var ___stack_high = 13876608;
1789
+ var ___stack_high = 13876672;
1790
1790
 
1791
- var ___stack_low = 12828032;
1791
+ var ___stack_low = 12828096;
1792
1792
 
1793
1793
  var ___stack_pointer = new WebAssembly.Global(
1794
1794
  { value: 'i32', mutable: true },
1795
- 13876608
1795
+ 13876672
1796
1796
  );
1797
1797
 
1798
1798
  var PATH = {
@@ -6926,24 +6926,36 @@ export function init(RuntimeName, PHPLoader) {
6926
6926
  }
6927
6927
 
6928
6928
  function _fd_close(fd) {
6929
- const [vfsPath, pathResolutionErrno] = locking.get_vfs_path_from_fd(fd);
6930
- if (pathResolutionErrno !== 0) {
6931
- _js_wasm_trace(
6932
- 'fd_close(%d) get_vfs_path_from_fd error %d',
6933
- fd,
6934
- pathResolutionErrno
6935
- );
6936
- return -ERRNO_CODES.EBADF;
6937
- }
6938
-
6939
- const result = _builtin_fd_close(fd);
6940
- if (result !== 0 || !locking.maybeLockedFds.has(fd)) {
6941
- _js_wasm_trace('fd_close(%d) result %d', fd, result);
6942
- return result;
6929
+ const fdCloseResult = _builtin_fd_close(fd);
6930
+ if (fdCloseResult !== 0 || !locking.maybeLockedFds.has(fd)) {
6931
+ _js_wasm_trace('fd_close(%d) result %d', fd, fdCloseResult);
6932
+ return fdCloseResult;
6943
6933
  }
6944
- const nativeFilePath = locking.get_native_path_from_vfs_path(vfsPath);
6945
6934
 
6946
6935
  try {
6936
+ const [vfsPath, pathResolutionErrno] =
6937
+ locking.get_vfs_path_from_fd(fd);
6938
+ if (pathResolutionErrno !== 0) {
6939
+ _js_wasm_trace(
6940
+ 'fd_close(%d) get_vfs_path_from_fd error %d',
6941
+ fd,
6942
+ pathResolutionErrno
6943
+ );
6944
+ /*
6945
+ * It looks like the file may have had an associated lock,
6946
+ * but since we cannot look up the path,
6947
+ * there is nothing more for us to do.
6948
+ *
6949
+ * NOTE: This seems possible for files that are locked and
6950
+ * then unlinked before close. It is an opportunity for a
6951
+ * lock to be orphaned in the lock manager.
6952
+ * @TODO: Explore how to ensure cleanup in this case.
6953
+ */
6954
+ return fdCloseResult;
6955
+ }
6956
+
6957
+ const nativeFilePath =
6958
+ locking.get_native_path_from_vfs_path(vfsPath);
6947
6959
  PHPLoader.fileLockManager.releaseLocksForProcessFd(
6948
6960
  PHPLoader.processId,
6949
6961
  fd,
@@ -6955,7 +6967,7 @@ export function init(RuntimeName, PHPLoader) {
6955
6967
  } finally {
6956
6968
  locking.maybeLockedFds.delete(fd);
6957
6969
  }
6958
- return result;
6970
+ return fdCloseResult;
6959
6971
  }
6960
6972
  _fd_close.sig = 'ii';
6961
6973
  function _builtin_fd_close(fd) {
@@ -7069,8 +7081,12 @@ export function init(RuntimeName, PHPLoader) {
7069
7081
  }
7070
7082
  },
7071
7083
  get_native_path_from_vfs_path(vfsPath) {
7072
- // TODO: Should there be a try/catch here?
7073
- const { node } = FS.lookupPath(vfsPath, {});
7084
+ const { node } = FS.lookupPath(vfsPath, {
7085
+ noent_okay: true,
7086
+ });
7087
+ if (!node) {
7088
+ throw new Error(`No node found for VFS path ${vfsPath}`);
7089
+ }
7074
7090
  if (node.mount.type === NODEFS) {
7075
7091
  return NODEFS.realPath(node);
7076
7092
  } else if (node.mount.type === PROXYFS) {
@@ -7340,10 +7356,9 @@ export function init(RuntimeName, PHPLoader) {
7340
7356
  return -ERRNO_CODES.EINVAL;
7341
7357
  }
7342
7358
 
7343
- const nativeFilePath =
7344
- locking.get_native_path_from_vfs_path(vfsPath);
7345
-
7346
7359
  try {
7360
+ const nativeFilePath =
7361
+ locking.get_native_path_from_vfs_path(vfsPath);
7347
7362
  const conflictingLock =
7348
7363
  PHPLoader.fileLockManager.findFirstConflictingByteRangeLock(
7349
7364
  nativeFilePath,
@@ -7477,16 +7492,16 @@ export function init(RuntimeName, PHPLoader) {
7477
7492
  pid,
7478
7493
  };
7479
7494
 
7480
- const nativeFilePath =
7481
- locking.get_native_path_from_vfs_path(vfsPath);
7482
- _js_wasm_trace(
7483
- 'fcntl(%d, F_SETLK) %s calling lockFileByteRange for range lock %s',
7484
- fd,
7485
- vfsPath,
7486
- rangeLock
7487
- );
7488
-
7489
7495
  try {
7496
+ const nativeFilePath =
7497
+ locking.get_native_path_from_vfs_path(vfsPath);
7498
+ _js_wasm_trace(
7499
+ 'fcntl(%d, F_SETLK) %s calling lockFileByteRange for range lock %s',
7500
+ fd,
7501
+ vfsPath,
7502
+ rangeLock
7503
+ );
7504
+
7490
7505
  const succeeded =
7491
7506
  PHPLoader.fileLockManager.lockFileByteRange(
7492
7507
  nativeFilePath,
@@ -17407,8 +17422,9 @@ export function init(RuntimeName, PHPLoader) {
17407
17422
  return -ERRNO_CODES.EINVAL;
17408
17423
  }
17409
17424
 
17410
- const nativeFilePath = locking.get_native_path_from_vfs_path(vfsPath);
17411
17425
  try {
17426
+ const nativeFilePath =
17427
+ locking.get_native_path_from_vfs_path(vfsPath);
17412
17428
  const obtainedLock = PHPLoader.fileLockManager.lockWholeFile(
17413
17429
  nativeFilePath,
17414
17430
  {
@@ -17744,9 +17760,9 @@ export function init(RuntimeName, PHPLoader) {
17744
17760
  if (!cp.stdin.closed) {
17745
17761
  cp.stdin.end();
17746
17762
  }
17747
- _free(buffer);
17748
- _free(iov);
17749
- _free(pnum);
17763
+ PHPLoader['free'](buffer);
17764
+ PHPLoader['free'](iov);
17765
+ PHPLoader['free'](pnum);
17750
17766
  }
17751
17767
 
17752
17768
  // pump() can never alter the result of this function.
@@ -18579,6 +18595,11 @@ export function init(RuntimeName, PHPLoader) {
18579
18595
  return ret;
18580
18596
  };
18581
18597
 
18598
+ var setErrNo = (value) => {
18599
+ HEAP32[___errno_location() >> 2] = value;
18600
+ return value;
18601
+ };
18602
+
18582
18603
  var FS_createPath = FS.createPath;
18583
18604
 
18584
18605
  var FS_unlink = (path) => FS.unlink(path);
@@ -31595,11 +31616,6 @@ export function init(RuntimeName, PHPLoader) {
31595
31616
 
31596
31617
  var allocateUTF8 = stringToNewUTF8;
31597
31618
 
31598
- var setErrNo = (value) => {
31599
- HEAP32[___errno_location() >> 2] = value;
31600
- return value;
31601
- };
31602
-
31603
31619
  var demangle = (func) => {
31604
31620
  // If demangle has failed before, stop demangling any further function names
31605
31621
  // This avoids an infinite recursion with malloc()->abort()->stackTrace()->demangle()->malloc()->...
@@ -32099,13 +32115,13 @@ export function init(RuntimeName, PHPLoader) {
32099
32115
  // End JS library code
32100
32116
 
32101
32117
  var ASM_CONSTS = {
32102
- 12632557: ($0) => {
32118
+ 12632621: ($0) => {
32103
32119
  if (!$0) {
32104
32120
  AL.alcErr = 0xa004;
32105
32121
  return 1;
32106
32122
  }
32107
32123
  },
32108
- 12632605: ($0) => {
32124
+ 12632669: ($0) => {
32109
32125
  if (!AL.currentCtx) {
32110
32126
  err('alGetProcAddress() called without a valid context');
32111
32127
  return 1;
@@ -35532,6 +35548,7 @@ export function init(RuntimeName, PHPLoader) {
35532
35548
  Module['FS_createDevice'] = FS_createDevice;
35533
35549
  Module['FS_createDataFile'] = FS_createDataFile;
35534
35550
  Module['FS_createLazyFile'] = FS_createLazyFile;
35551
+ Module['setErrNo'] = setErrNo;
35535
35552
  Module['PROXYFS'] = PROXYFS;
35536
35553
 
35537
35554
  function callMain(args = []) {
@@ -6,10 +6,10 @@ const require = createRequire(import.meta.url);
6
6
  // Note: The path module is currently needed by code injected by the php-wasm Dockerfile.
7
7
  import path from 'path';
8
8
 
9
- const dependencyFilename = path.join(__dirname, '8_4_11', 'php_8_4.wasm');
9
+ const dependencyFilename = path.join(__dirname, '8_4_12', 'php_8_4.wasm');
10
10
  export { dependencyFilename };
11
- export const dependenciesTotalSize = 30324415;
12
- const phpVersionString = '8.4.11';
11
+ export const dependenciesTotalSize = 30326874;
12
+ const phpVersionString = '8.4.12';
13
13
  export function init(RuntimeName, PHPLoader) {
14
14
  // The rest of the code comes from the built php.js file and esm-suffix.js
15
15
  // include: shell.js
@@ -831,7 +831,7 @@ export function init(RuntimeName, PHPLoader) {
831
831
  },
832
832
  };
833
833
 
834
- var ___heap_base = 16972416;
834
+ var ___heap_base = 16972480;
835
835
 
836
836
  var alignMemory = (size, alignment) => {
837
837
  return Math.ceil(size / alignment) * alignment;
@@ -1786,13 +1786,13 @@ export function init(RuntimeName, PHPLoader) {
1786
1786
  1024
1787
1787
  );
1788
1788
 
1789
- var ___stack_high = 16972416;
1789
+ var ___stack_high = 16972480;
1790
1790
 
1791
- var ___stack_low = 15923840;
1791
+ var ___stack_low = 15923904;
1792
1792
 
1793
1793
  var ___stack_pointer = new WebAssembly.Global(
1794
1794
  { value: 'i32', mutable: true },
1795
- 16972416
1795
+ 16972480
1796
1796
  );
1797
1797
 
1798
1798
  var PATH = {
@@ -6926,24 +6926,36 @@ export function init(RuntimeName, PHPLoader) {
6926
6926
  }
6927
6927
 
6928
6928
  function _fd_close(fd) {
6929
- const [vfsPath, pathResolutionErrno] = locking.get_vfs_path_from_fd(fd);
6930
- if (pathResolutionErrno !== 0) {
6931
- _js_wasm_trace(
6932
- 'fd_close(%d) get_vfs_path_from_fd error %d',
6933
- fd,
6934
- pathResolutionErrno
6935
- );
6936
- return -ERRNO_CODES.EBADF;
6937
- }
6938
-
6939
- const result = _builtin_fd_close(fd);
6940
- if (result !== 0 || !locking.maybeLockedFds.has(fd)) {
6941
- _js_wasm_trace('fd_close(%d) result %d', fd, result);
6942
- return result;
6929
+ const fdCloseResult = _builtin_fd_close(fd);
6930
+ if (fdCloseResult !== 0 || !locking.maybeLockedFds.has(fd)) {
6931
+ _js_wasm_trace('fd_close(%d) result %d', fd, fdCloseResult);
6932
+ return fdCloseResult;
6943
6933
  }
6944
- const nativeFilePath = locking.get_native_path_from_vfs_path(vfsPath);
6945
6934
 
6946
6935
  try {
6936
+ const [vfsPath, pathResolutionErrno] =
6937
+ locking.get_vfs_path_from_fd(fd);
6938
+ if (pathResolutionErrno !== 0) {
6939
+ _js_wasm_trace(
6940
+ 'fd_close(%d) get_vfs_path_from_fd error %d',
6941
+ fd,
6942
+ pathResolutionErrno
6943
+ );
6944
+ /*
6945
+ * It looks like the file may have had an associated lock,
6946
+ * but since we cannot look up the path,
6947
+ * there is nothing more for us to do.
6948
+ *
6949
+ * NOTE: This seems possible for files that are locked and
6950
+ * then unlinked before close. It is an opportunity for a
6951
+ * lock to be orphaned in the lock manager.
6952
+ * @TODO: Explore how to ensure cleanup in this case.
6953
+ */
6954
+ return fdCloseResult;
6955
+ }
6956
+
6957
+ const nativeFilePath =
6958
+ locking.get_native_path_from_vfs_path(vfsPath);
6947
6959
  PHPLoader.fileLockManager.releaseLocksForProcessFd(
6948
6960
  PHPLoader.processId,
6949
6961
  fd,
@@ -6955,7 +6967,7 @@ export function init(RuntimeName, PHPLoader) {
6955
6967
  } finally {
6956
6968
  locking.maybeLockedFds.delete(fd);
6957
6969
  }
6958
- return result;
6970
+ return fdCloseResult;
6959
6971
  }
6960
6972
  _fd_close.sig = 'ii';
6961
6973
  function _builtin_fd_close(fd) {
@@ -7069,8 +7081,12 @@ export function init(RuntimeName, PHPLoader) {
7069
7081
  }
7070
7082
  },
7071
7083
  get_native_path_from_vfs_path(vfsPath) {
7072
- // TODO: Should there be a try/catch here?
7073
- const { node } = FS.lookupPath(vfsPath, {});
7084
+ const { node } = FS.lookupPath(vfsPath, {
7085
+ noent_okay: true,
7086
+ });
7087
+ if (!node) {
7088
+ throw new Error(`No node found for VFS path ${vfsPath}`);
7089
+ }
7074
7090
  if (node.mount.type === NODEFS) {
7075
7091
  return NODEFS.realPath(node);
7076
7092
  } else if (node.mount.type === PROXYFS) {
@@ -7340,10 +7356,9 @@ export function init(RuntimeName, PHPLoader) {
7340
7356
  return -ERRNO_CODES.EINVAL;
7341
7357
  }
7342
7358
 
7343
- const nativeFilePath =
7344
- locking.get_native_path_from_vfs_path(vfsPath);
7345
-
7346
7359
  try {
7360
+ const nativeFilePath =
7361
+ locking.get_native_path_from_vfs_path(vfsPath);
7347
7362
  const conflictingLock =
7348
7363
  PHPLoader.fileLockManager.findFirstConflictingByteRangeLock(
7349
7364
  nativeFilePath,
@@ -7477,16 +7492,16 @@ export function init(RuntimeName, PHPLoader) {
7477
7492
  pid,
7478
7493
  };
7479
7494
 
7480
- const nativeFilePath =
7481
- locking.get_native_path_from_vfs_path(vfsPath);
7482
- _js_wasm_trace(
7483
- 'fcntl(%d, F_SETLK) %s calling lockFileByteRange for range lock %s',
7484
- fd,
7485
- vfsPath,
7486
- rangeLock
7487
- );
7488
-
7489
7495
  try {
7496
+ const nativeFilePath =
7497
+ locking.get_native_path_from_vfs_path(vfsPath);
7498
+ _js_wasm_trace(
7499
+ 'fcntl(%d, F_SETLK) %s calling lockFileByteRange for range lock %s',
7500
+ fd,
7501
+ vfsPath,
7502
+ rangeLock
7503
+ );
7504
+
7490
7505
  const succeeded =
7491
7506
  PHPLoader.fileLockManager.lockFileByteRange(
7492
7507
  nativeFilePath,
@@ -17407,8 +17422,9 @@ export function init(RuntimeName, PHPLoader) {
17407
17422
  return -ERRNO_CODES.EINVAL;
17408
17423
  }
17409
17424
 
17410
- const nativeFilePath = locking.get_native_path_from_vfs_path(vfsPath);
17411
17425
  try {
17426
+ const nativeFilePath =
17427
+ locking.get_native_path_from_vfs_path(vfsPath);
17412
17428
  const obtainedLock = PHPLoader.fileLockManager.lockWholeFile(
17413
17429
  nativeFilePath,
17414
17430
  {
@@ -17744,9 +17760,9 @@ export function init(RuntimeName, PHPLoader) {
17744
17760
  if (!cp.stdin.closed) {
17745
17761
  cp.stdin.end();
17746
17762
  }
17747
- _free(buffer);
17748
- _free(iov);
17749
- _free(pnum);
17763
+ PHPLoader['free'](buffer);
17764
+ PHPLoader['free'](iov);
17765
+ PHPLoader['free'](pnum);
17750
17766
  }
17751
17767
 
17752
17768
  // pump() can never alter the result of this function.
@@ -18579,6 +18595,11 @@ export function init(RuntimeName, PHPLoader) {
18579
18595
  return ret;
18580
18596
  };
18581
18597
 
18598
+ var setErrNo = (value) => {
18599
+ HEAP32[___errno_location() >> 2] = value;
18600
+ return value;
18601
+ };
18602
+
18582
18603
  var FS_createPath = FS.createPath;
18583
18604
 
18584
18605
  var FS_unlink = (path) => FS.unlink(path);
@@ -31595,11 +31616,6 @@ export function init(RuntimeName, PHPLoader) {
31595
31616
 
31596
31617
  var allocateUTF8 = stringToNewUTF8;
31597
31618
 
31598
- var setErrNo = (value) => {
31599
- HEAP32[___errno_location() >> 2] = value;
31600
- return value;
31601
- };
31602
-
31603
31619
  var demangle = (func) => {
31604
31620
  // If demangle has failed before, stop demangling any further function names
31605
31621
  // This avoids an infinite recursion with malloc()->abort()->stackTrace()->demangle()->malloc()->...
@@ -32099,13 +32115,13 @@ export function init(RuntimeName, PHPLoader) {
32099
32115
  // End JS library code
32100
32116
 
32101
32117
  var ASM_CONSTS = {
32102
- 15723805: ($0) => {
32118
+ 15723869: ($0) => {
32103
32119
  if (!$0) {
32104
32120
  AL.alcErr = 0xa004;
32105
32121
  return 1;
32106
32122
  }
32107
32123
  },
32108
- 15723853: ($0) => {
32124
+ 15723917: ($0) => {
32109
32125
  if (!AL.currentCtx) {
32110
32126
  err('alGetProcAddress() called without a valid context');
32111
32127
  return 1;
@@ -35519,6 +35535,7 @@ export function init(RuntimeName, PHPLoader) {
35519
35535
  Module['FS_createDevice'] = FS_createDevice;
35520
35536
  Module['FS_createDataFile'] = FS_createDataFile;
35521
35537
  Module['FS_createLazyFile'] = FS_createLazyFile;
35538
+ Module['setErrNo'] = setErrNo;
35522
35539
  Module['PROXYFS'] = PROXYFS;
35523
35540
 
35524
35541
  function callMain(args = []) {