@@ -96,34 +96,18 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */
96
96
phpdbg_param_t * name = NULL ;
97
97
98
98
if (stack -> type == STACK_PARAM ) {
99
- char * lc_name ;
100
-
101
99
name = stack -> next ;
102
100
103
101
if (!name || name -> type != STR_PARAM ) {
104
102
return FAILURE ;
105
103
}
106
104
107
- lc_name = zend_str_tolower_dup (name -> str , name -> len );
108
-
109
- if (zend_hash_str_exists (& PHPDBG_G (registered ), lc_name , name -> len )) {
110
- zval fretval ;
111
- zend_fcall_info fci ;
112
-
113
- memset (& fci , 0 , sizeof (zend_fcall_info ));
114
-
115
- ZVAL_STRINGL (& fci .function_name , lc_name , name -> len );
116
- fci .size = sizeof (zend_fcall_info );
117
- fci .object = NULL ;
118
- fci .retval = & fretval ;
119
- fci .param_count = 0 ;
120
- fci .params = NULL ;
121
- fci .named_params = NULL ;
122
-
123
- zval params ;
105
+ zend_function * user_fn = zend_hash_str_find_ptr_lc (& PHPDBG_G (registered ), name -> str , name -> len );
106
+ if (user_fn != NULL ) {
107
+ HashTable * params_ht = NULL ;
124
108
if (name -> next ) {
125
109
phpdbg_param_t * next = name -> next ;
126
-
110
+ zval params ;
127
111
array_init (& params );
128
112
129
113
while (next ) {
@@ -173,27 +157,19 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack) /* {{{ */
173
157
next = next -> next ;
174
158
}
175
159
/* Add positional arguments */
176
- fci .named_params = Z_ARRVAL (params );
160
+ params_ht = Z_ARRVAL (params );
161
+ phpdbg_debug ("created " PRIu32 " params from arguments" , zend_hash_num_elements (params_ht ));
177
162
}
178
163
179
164
phpdbg_activate_err_buf (0 );
180
165
phpdbg_free_err_buf ();
181
166
182
- phpdbg_debug ("created %d params from arguments" , fci .param_count );
183
167
184
- if (zend_call_function (& fci , NULL ) == SUCCESS ) {
185
- zend_print_zval_r (& fretval , 0 );
186
- phpdbg_out ("\n" );
187
- zval_ptr_dtor (& fretval );
188
- }
189
-
190
- zval_ptr_dtor_str (& fci .function_name );
191
- efree (lc_name );
168
+ zend_call_known_function (user_fn , NULL , NULL , NULL , 0 , NULL , params_ht );
169
+ phpdbg_out ("\n" );
192
170
193
171
return SUCCESS ;
194
172
}
195
-
196
- efree (lc_name );
197
173
}
198
174
199
175
return FAILURE ;
0 commit comments