diff options
Diffstat (limited to 'win32/signal.c')
| -rw-r--r-- | win32/signal.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/win32/signal.c b/win32/signal.c index bdfd7033f3..27ebf835c9 100644 --- a/win32/signal.c +++ b/win32/signal.c @@ -1,7 +1,5 @@ /* +----------------------------------------------------------------------+ - | PHP Version 7 | - +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | @@ -93,21 +91,22 @@ PHP_FUNCTION(sapi_windows_set_ctrl_handler) zval *handler = NULL; zend_bool add = 1; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &handler, &add) == FAILURE) { + RETURN_THROWS(); + } + #if ZTS if (!tsrm_is_main_thread()) { - php_error_docref(NULL, E_WARNING, "CTRL events can only be received on the main thread"); + zend_throw_error(NULL, "CTRL events can only be received on the main thread"); return; } #endif if (!php_win32_console_is_cli_sapi()) { - php_error_docref(NULL, E_WARNING, "CTRL events trapping is only supported on console"); + zend_throw_error(NULL, "CTRL events trapping is only supported on console"); return; } - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z|b", &handler, &add) == FAILURE) { - return; - } if (IS_NULL == Z_TYPE_P(handler)) { zval_dtor(&ctrl_handler); @@ -120,9 +119,9 @@ PHP_FUNCTION(sapi_windows_set_ctrl_handler) if (!zend_is_callable(handler, 0, NULL)) { zend_string *func_name = zend_get_callable_name(handler); - php_error_docref(NULL, E_WARNING, "%s is not a callable function name error", ZSTR_VAL(func_name)); + zend_type_error("%s is not a callable function name error", ZSTR_VAL(func_name)); zend_string_release_ex(func_name, 0); - RETURN_FALSE; + return; } if (!SetConsoleCtrlHandler(NULL, FALSE) || !SetConsoleCtrlHandler(php_win32_signal_system_ctrl_handler, add)) { @@ -143,12 +142,12 @@ PHP_FUNCTION(sapi_windows_generate_ctrl_event) zend_long evt, pid = 0; zend_bool ret = 0; - if (!php_win32_console_is_cli_sapi()) { - php_error_docref(NULL, E_WARNING, "CTRL events trapping is only supported on console"); - return; + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &evt, &pid) == FAILURE) { + RETURN_THROWS(); } - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l", &evt, &pid) == FAILURE) { + if (!php_win32_console_is_cli_sapi()) { + zend_throw_error(NULL, "CTRL events trapping is only supported on console"); return; } |
