1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.4' into PHP-8.5

* PHP-8.4:
  ext/pcntl: Fix signal table updated before php_signal4 succeeds in pcntl_signal
This commit is contained in:
David Carlier
2026-02-23 12:48:30 +00:00

View File

@@ -846,15 +846,16 @@ PHP_FUNCTION(pcntl_signal)
RETURN_THROWS();
}
/* Add the function name to our signal table */
handle = zend_hash_index_update(&PCNTL_G(php_signal_table), signo, handle);
Z_TRY_ADDREF_P(handle);
/* Register with the OS first so that on failure we don't record a handler that was never installed */
if (php_signal4(signo, pcntl_signal_handler, (int) restart_syscalls, 1) == (void *)SIG_ERR) {
PCNTL_G(last_error) = errno;
php_error_docref(NULL, E_WARNING, "Error assigning signal");
RETURN_FALSE;
}
/* Add the function name to our signal table */
handle = zend_hash_index_update(&PCNTL_G(php_signal_table), signo, handle);
Z_TRY_ADDREF_P(handle);
RETURN_TRUE;
}
/* }}} */