@php-wasm/node-8-5 3.1.62 → 3.1.63

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.
Binary file
@@ -15,7 +15,7 @@ const currentDirPath =
15
15
  : path.dirname(fileURLToPath(import.meta.url));
16
16
  const dependencyFilename = path.join(currentDirPath, '8_5_12', 'php_8_5.wasm');
17
17
  export { dependencyFilename };
18
- export const dependenciesTotalSize = 26736411;
18
+ export const dependenciesTotalSize = 26736418;
19
19
  const phpVersionString = '8.5.12';
20
20
  export function init(RuntimeName, PHPLoader) {
21
21
  // The rest of the code comes from the built php.js file and esm-suffix.js
@@ -9377,13 +9377,11 @@ export function init(RuntimeName, PHPLoader) {
9377
9377
  envLength
9378
9378
  ) {
9379
9379
  if (!command) {
9380
- ___errno_location(ERRNO_CODES.EINVAL);
9381
- return -1;
9380
+ return -ERRNO_CODES.EINVAL;
9382
9381
  }
9383
9382
  const cmdstr = UTF8ToString(command);
9384
9383
  if (!cmdstr.length) {
9385
- ___errno_location(ERRNO_CODES.EINVAL);
9386
- return -1;
9384
+ return -ERRNO_CODES.EINVAL;
9387
9385
  }
9388
9386
  let argsArray = [];
9389
9387
  if (argsLength) {
@@ -9443,13 +9441,11 @@ export function init(RuntimeName, PHPLoader) {
9443
9441
  }
9444
9442
  } catch (e) {
9445
9443
  if (e.code === 'SPAWN_UNSUPPORTED') {
9446
- ___errno_location(ERRNO_CODES.ENOSYS);
9447
- return -1;
9444
+ return -ERRNO_CODES.ENOSYS;
9448
9445
  }
9449
9446
  if (typeof FS == 'undefined' || !(e.name === 'ErrnoError'))
9450
9447
  throw e;
9451
- ___errno_location(e.code);
9452
- return -1;
9448
+ return -e.errno;
9453
9449
  }
9454
9450
  const ProcInfo = {
9455
9451
  pid: cp.pid,
@@ -9463,20 +9459,31 @@ export function init(RuntimeName, PHPLoader) {
9463
9459
  stderrChildFd = std[2]?.child,
9464
9460
  stderrParentFd = std[2]?.parent;
9465
9461
  const detachPipeDataListeners = [];
9466
- cp.on('exit', function (code) {
9462
+ /**
9463
+ * Closes the child ends of the pipes so a blocking fread() on the
9464
+ * parent end sees a broken pipe instead of polling forever. Runs on
9465
+ * 'exit' and when the spawn wait fails, because a failed spawn may
9466
+ * never emit 'exit'.
9467
+ *
9468
+ * Runs at most once. After the first call, PHP may reuse these fd
9469
+ * numbers for unrelated streams that a late 'exit' must not close.
9470
+ */ let childPipesClosed = false;
9471
+ const closeChildPipes = function () {
9472
+ if (childPipesClosed) {
9473
+ return;
9474
+ }
9475
+ childPipesClosed = true;
9467
9476
  for (const detach of detachPipeDataListeners) {
9468
9477
  detach();
9469
9478
  }
9470
- for (const fd of [
9471
- // The child process exited. Let's clean up its output streams:
9472
- stdoutChildFd,
9473
- stderrChildFd,
9474
- stdinChildFd,
9475
- ]) {
9479
+ for (const fd of [stdoutChildFd, stderrChildFd, stdinChildFd]) {
9476
9480
  if (FS.streams[fd] && !FS.isClosed(FS.streams[fd])) {
9477
9481
  FS.close(FS.streams[fd]);
9478
9482
  }
9479
9483
  }
9484
+ };
9485
+ cp.on('exit', function (code) {
9486
+ closeChildPipes();
9480
9487
  ProcInfo.exitCode = code;
9481
9488
  ProcInfo.exited = true;
9482
9489
  });
@@ -9584,6 +9591,10 @@ export function init(RuntimeName, PHPLoader) {
9584
9591
  // Process already started. Even if it exited early, PHP still
9585
9592
  // needs to know about the pid and clean up the resources.
9586
9593
  console.error(e);
9594
+ closeChildPipes();
9595
+ if (!ProcInfo.pid) {
9596
+ return -(ERRNO_CODES[e.code] ?? ERRNO_CODES.ECHILD);
9597
+ }
9587
9598
  return ProcInfo.pid;
9588
9599
  }
9589
9600
  // Now we want to pass data from the STDIN source supplied by PHP
@@ -10667,10 +10678,7 @@ export function init(RuntimeName, PHPLoader) {
10667
10678
  return ERRNO_CODES.EWOULDBLOCK;
10668
10679
  }
10669
10680
  return returnCallback(async (wakeUp) => {
10670
- var retries = 0;
10671
10681
  var interval = 50;
10672
- var timeout = 5e3;
10673
- var maxRetries = timeout / interval;
10674
10682
  while (true) {
10675
10683
  var returnCode;
10676
10684
  var stream;
@@ -10694,7 +10702,6 @@ export function init(RuntimeName, PHPLoader) {
10694
10702
  return wakeUp(0);
10695
10703
  }
10696
10704
  if (
10697
- ++retries > maxRetries ||
10698
10705
  !stream ||
10699
10706
  FS.isClosed(stream) ||
10700
10707
  returnCode !== ERRNO_CODES.EWOULDBLOCK ||
@@ -12078,69 +12085,69 @@ export function init(RuntimeName, PHPLoader) {
12078
12085
  wasmExports['__indirect_function_table'];
12079
12086
  }
12080
12087
 
12081
- var _core_globals = (Module['_core_globals'] = 18176416);
12088
+ var _core_globals = (Module['_core_globals'] = 18176320);
12082
12089
 
12083
- var _php_ini_opened_path = (Module['_php_ini_opened_path'] = 18064256);
12090
+ var _php_ini_opened_path = (Module['_php_ini_opened_path'] = 18064160);
12084
12091
 
12085
- var _php_ini_scanned_path = (Module['_php_ini_scanned_path'] = 18064260);
12092
+ var _php_ini_scanned_path = (Module['_php_ini_scanned_path'] = 18064164);
12086
12093
 
12087
- var _php_ini_scanned_files = (Module['_php_ini_scanned_files'] = 18064264);
12094
+ var _php_ini_scanned_files = (Module['_php_ini_scanned_files'] = 18064168);
12088
12095
 
12089
- var _sapi_module = (Module['_sapi_module'] = 18059424);
12096
+ var _sapi_module = (Module['_sapi_module'] = 18059328);
12090
12097
 
12091
- var _sapi_globals = (Module['_sapi_globals'] = 18059576);
12098
+ var _sapi_globals = (Module['_sapi_globals'] = 18059480);
12092
12099
 
12093
- var _module_registry = (Module['_module_registry'] = 18178304);
12100
+ var _module_registry = (Module['_module_registry'] = 18178208);
12094
12101
 
12095
- var _zend_ce_closure = (Module['_zend_ce_closure'] = 18177292);
12102
+ var _zend_ce_closure = (Module['_zend_ce_closure'] = 18177196);
12096
12103
 
12097
- var _compiler_globals = (Module['_compiler_globals'] = 18180984);
12104
+ var _compiler_globals = (Module['_compiler_globals'] = 18180888);
12098
12105
 
12099
- var _executor_globals = (Module['_executor_globals'] = 18181400);
12106
+ var _executor_globals = (Module['_executor_globals'] = 18181304);
12100
12107
 
12101
- var _zend_compile_file = (Module['_zend_compile_file'] = 18182832);
12108
+ var _zend_compile_file = (Module['_zend_compile_file'] = 18182736);
12102
12109
 
12103
- var _zend_ce_exception = (Module['_zend_ce_exception'] = 18177420);
12110
+ var _zend_ce_exception = (Module['_zend_ce_exception'] = 18177324);
12104
12111
 
12105
- var _zend_ce_error = (Module['_zend_ce_error'] = 18177544);
12112
+ var _zend_ce_error = (Module['_zend_ce_error'] = 18177448);
12106
12113
 
12107
12114
  var _zend_throw_exception_hook = (Module['_zend_throw_exception_hook'] =
12108
- 18177416);
12115
+ 18177320);
12109
12116
 
12110
- var _zend_ce_throwable = (Module['_zend_ce_throwable'] = 18177424);
12117
+ var _zend_ce_throwable = (Module['_zend_ce_throwable'] = 18177328);
12111
12118
 
12112
- var _zend_execute_ex = (Module['_zend_execute_ex'] = 18180960);
12119
+ var _zend_execute_ex = (Module['_zend_execute_ex'] = 18180864);
12113
12120
 
12114
- var _zend_execute_internal = (Module['_zend_execute_internal'] = 18180964);
12121
+ var _zend_execute_internal = (Module['_zend_execute_internal'] = 18180868);
12115
12122
 
12116
12123
  var _zend_pass_function = (Module['_zend_pass_function'] = 17542944);
12117
12124
 
12118
- var _zend_extensions = (Module['_zend_extensions'] = 18177260);
12125
+ var _zend_extensions = (Module['_zend_extensions'] = 18177164);
12119
12126
 
12120
- var _gc_collect_cycles = (Module['_gc_collect_cycles'] = 18178688);
12127
+ var _gc_collect_cycles = (Module['_gc_collect_cycles'] = 18178592);
12121
12128
 
12122
12129
  var _zend_empty_array = (Module['_zend_empty_array'] = 17542064);
12123
12130
 
12124
- var _zend_ce_aggregate = (Module['_zend_ce_aggregate'] = 18058784);
12131
+ var _zend_ce_aggregate = (Module['_zend_ce_aggregate'] = 18058688);
12125
12132
 
12126
- var _zend_ce_iterator = (Module['_zend_ce_iterator'] = 18058788);
12133
+ var _zend_ce_iterator = (Module['_zend_ce_iterator'] = 18058692);
12127
12134
 
12128
- var _zend_ce_countable = (Module['_zend_ce_countable'] = 18058800);
12135
+ var _zend_ce_countable = (Module['_zend_ce_countable'] = 18058704);
12129
12136
 
12130
12137
  var _std_object_handlers = (Module['_std_object_handlers'] = 17539856);
12131
12138
 
12132
- var _zend_empty_string = (Module['_zend_empty_string'] = 18178692);
12139
+ var _zend_empty_string = (Module['_zend_empty_string'] = 18178596);
12133
12140
 
12134
- var _zend_known_strings = (Module['_zend_known_strings'] = 18178696);
12141
+ var _zend_known_strings = (Module['_zend_known_strings'] = 18178600);
12135
12142
 
12136
12143
  var _zend_string_init_interned = (Module['_zend_string_init_interned'] =
12137
- 18178764);
12144
+ 18178668);
12138
12145
 
12139
- var _zend_write = (Module['_zend_write'] = 18179844);
12146
+ var _zend_write = (Module['_zend_write'] = 18179748);
12140
12147
 
12141
- var _zend_error_cb = (Module['_zend_error_cb'] = 18179848);
12148
+ var _zend_error_cb = (Module['_zend_error_cb'] = 18179752);
12142
12149
 
12143
- var _zend_post_startup_cb = (Module['_zend_post_startup_cb'] = 18179816);
12150
+ var _zend_post_startup_cb = (Module['_zend_post_startup_cb'] = 18179720);
12144
12151
 
12145
12152
  var ___memory_base = (Module['___memory_base'] = 0);
12146
12153
 
@@ -12148,20 +12155,20 @@ export function init(RuntimeName, PHPLoader) {
12148
12155
 
12149
12156
  var _stderr = (Module['_stderr'] = 18051376);
12150
12157
 
12151
- var ___THREW__ = (Module['___THREW__'] = 18531188);
12158
+ var ___THREW__ = (Module['___THREW__'] = 18531092);
12152
12159
 
12153
- var ___threwValue = (Module['___threwValue'] = 18531192);
12160
+ var ___threwValue = (Module['___threwValue'] = 18531096);
12154
12161
 
12155
12162
  var _stdout = (Module['_stdout'] = 18051680);
12156
12163
 
12157
- var _timezone = (Module['_timezone'] = 18518112);
12164
+ var _timezone = (Module['_timezone'] = 18518016);
12158
12165
 
12159
- var _tzname = (Module['_tzname'] = 18518120);
12166
+ var _tzname = (Module['_tzname'] = 18518024);
12160
12167
 
12161
- var ___heap_base = 19579856;
12168
+ var ___heap_base = 19579760;
12162
12169
 
12163
12170
  var __ZNSt3__25ctypeIcE2idE = (Module['__ZNSt3__25ctypeIcE2idE'] =
12164
- 18531268);
12171
+ 18531172);
12165
12172
 
12166
12173
  var __ZTVN10__cxxabiv120__si_class_type_infoE = (Module[
12167
12174
  '__ZTVN10__cxxabiv120__si_class_type_infoE'
Binary file