@@ -91,21 +91,22 @@ PHP_FUNCTION(sapi_windows_set_ctrl_handler)
91
91
zval * handler = NULL ;
92
92
zend_bool add = 1 ;
93
93
94
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "z|b" , & handler , & add ) == FAILURE ) {
95
+ return ;
96
+ }
97
+
94
98
#if ZTS
95
99
if (!tsrm_is_main_thread ()) {
96
- php_error_docref (NULL , E_WARNING , "CTRL events can only be received on the main thread" );
100
+ zend_throw_error (NULL , "CTRL events can only be received on the main thread" );
97
101
return ;
98
102
}
99
103
#endif
100
104
101
105
if (!php_win32_console_is_cli_sapi ()) {
102
- php_error_docref (NULL , E_WARNING , "CTRL events trapping is only supported on console" );
106
+ zend_throw_error (NULL , "CTRL events trapping is only supported on console" );
103
107
return ;
104
108
}
105
109
106
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "z|b" , & handler , & add ) == FAILURE ) {
107
- return ;
108
- }
109
110
110
111
if (IS_NULL == Z_TYPE_P (handler )) {
111
112
zval_dtor (& ctrl_handler );
@@ -118,9 +119,9 @@ PHP_FUNCTION(sapi_windows_set_ctrl_handler)
118
119
119
120
if (!zend_is_callable (handler , 0 , NULL )) {
120
121
zend_string * func_name = zend_get_callable_name (handler );
121
- php_error_docref ( NULL , E_WARNING , "%s is not a callable function name error" , ZSTR_VAL (func_name ));
122
+ zend_type_error ( "%s is not a callable function name error" , ZSTR_VAL (func_name ));
122
123
zend_string_release_ex (func_name , 0 );
123
- RETURN_FALSE ;
124
+ return ;
124
125
}
125
126
126
127
if (!SetConsoleCtrlHandler (NULL , FALSE) || !SetConsoleCtrlHandler (php_win32_signal_system_ctrl_handler , add )) {
@@ -141,12 +142,12 @@ PHP_FUNCTION(sapi_windows_generate_ctrl_event)
141
142
zend_long evt , pid = 0 ;
142
143
zend_bool ret = 0 ;
143
144
144
- if (!php_win32_console_is_cli_sapi ()) {
145
- php_error_docref (NULL , E_WARNING , "CTRL events trapping is only supported on console" );
145
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "l|l" , & evt , & pid ) == FAILURE ) {
146
146
return ;
147
147
}
148
148
149
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "l|l" , & evt , & pid ) == FAILURE ) {
149
+ if (!php_win32_console_is_cli_sapi ()) {
150
+ zend_throw_error (NULL , "CTRL events trapping is only supported on console" );
150
151
return ;
151
152
}
152
153
0 commit comments