Skip to content

Commit

Permalink
Merge branch 'main' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechsTech committed Mar 14, 2023
2 parents 9bd71f2 + eded49d commit fbb8844
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 6 additions & 6 deletions preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,24 +255,24 @@ function ffi_char_variadic(string ...$string): CData
* @param array $env
* @return CData __char**__
*/
function ffi_char_assoc(array ...$items): CData
function ffi_char_assoc(array ...$items): ?CData
{
try {
if (@\count(@\reset($items)) > 0) {
$i = 0;
$environment = \FFI::new('char*[' . (\count($items) + 1) . ']', false);
foreach ($items as $key => $value) {
$is = \is_array($value);
$key = $is ? \array_key_first($value) : $key;
$entry = \sprintf('%s=%s', $key, $is ? @\array_values($value)[0] : $value);
$entry = \sprintf('%s=%s', $key, $is ? $value[$key] : $value);
$environment[$i] = \ffi_char($entry);
$i++;
}
$environment[$i] = NULL;
} catch (\Throwable $e) {
$environment = \ffi_null();

return \ze_cast('char**', $environment);
}

return \ze_cast('char**', $environment);
return null;
}

/**
Expand Down
4 changes: 1 addition & 3 deletions zend/StandardModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,6 @@ final public function __construct(
$this->startup();
}

if (\PHP_ZTS)
\tsrmls_cache_define();

if (\PHP_ZTS && \is_null($this->module_mutex))
$this->module_mutex = \ze_ffi()->tsrm_mutex_alloc();
}
Expand Down Expand Up @@ -460,6 +457,7 @@ final public function register(): void
$globalType = $this->global_type();
if (!\is_null($globalType)) {
if (\PHP_ZTS) {
\tsrmls_cache_define();
\tsrmls_activate();
$id = \ze_ffi()->tsrm_thread_id();
$this->global_rsrc[$id] = $this->ffi()->new('ts_rsrc_id', false, $this->target_persistent);
Expand Down

0 comments on commit fbb8844

Please sign in to comment.