File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -846,15 +846,16 @@ PHP_FUNCTION(pcntl_signal)
846846 RETURN_THROWS ();
847847 }
848848
849- /* Add the function name to our signal table */
850- handle = zend_hash_index_update (& PCNTL_G (php_signal_table ), signo , handle );
851- Z_TRY_ADDREF_P (handle );
852-
849+ /* Register with the OS first so that on failure we don't record a handler that was never installed */
853850 if (php_signal4 (signo , pcntl_signal_handler , (int ) restart_syscalls , 1 ) == (void * )SIG_ERR ) {
854851 PCNTL_G (last_error ) = errno ;
855852 php_error_docref (NULL , E_WARNING , "Error assigning signal" );
856853 RETURN_FALSE ;
857854 }
855+
856+ /* Add the function name to our signal table */
857+ handle = zend_hash_index_update (& PCNTL_G (php_signal_table ), signo , handle );
858+ Z_TRY_ADDREF_P (handle );
858859 RETURN_TRUE ;
859860}
860861/* }}} */
You can’t perform that action at this time.
0 commit comments