@@ -179,6 +179,28 @@ ZEND_API void zend_register_class_autoloader(zend_fcall_info *fci, zend_fcall_in
179179}
180180
181181// TODO USERLAND FUNCTIONS, maybe namespace them?
182+ static void autoload_list (INTERNAL_FUNCTION_PARAMETERS , HashTable * symbol_table )
183+ {
184+
185+ zend_fcall_info_cache * func_info ;
186+
187+ if (zend_parse_parameters_none () == FAILURE ) {
188+ RETURN_THROWS ();
189+ }
190+
191+ if (!symbol_table ) {
192+ RETURN_EMPTY_ARRAY ();
193+ }
194+
195+ array_init (return_value );
196+
197+ ZEND_HASH_FOREACH_PTR (symbol_table , func_info ) {
198+ zval tmp ;
199+ zend_get_callable_zval_from_fcc (func_info , & tmp );
200+ add_next_index_zval (return_value , & tmp );
201+ } ZEND_HASH_FOREACH_END ();
202+ }
203+
182204/* Register given function as a class autoloader */
183205ZEND_FUNCTION (autoload_register_class )
184206{
@@ -252,23 +274,7 @@ ZEND_FUNCTION(autoload_call_class)
252274/* Return all registered class autoloader functions */
253275ZEND_FUNCTION (autoload_list_class )
254276{
255- zend_fcall_info_cache * func_info ;
256-
257- if (zend_parse_parameters_none () == FAILURE ) {
258- RETURN_THROWS ();
259- }
260-
261- if (!autoloader_class_autoload_functions ) {
262- RETURN_EMPTY_ARRAY ();
263- }
264-
265- array_init (return_value );
266-
267- ZEND_HASH_FOREACH_PTR (autoloader_class_autoload_functions , func_info ) {
268- zval tmp ;
269- zend_get_callable_zval_from_fcc (func_info , & tmp );
270- add_next_index_zval (return_value , & tmp );
271- } ZEND_HASH_FOREACH_END ();
277+ autoload_list (INTERNAL_FUNCTION_PARAM_PASSTHRU , autoloader_class_autoload_functions );
272278}
273279
274280/* Register given function as a function autoloader */
@@ -370,23 +376,7 @@ ZEND_FUNCTION(autoload_call_function)
370376/* Return all registered function autoloader functions */
371377ZEND_FUNCTION (autoload_list_function )
372378{
373- zend_fcall_info_cache * func_info ;
374-
375- if (zend_parse_parameters_none () == FAILURE ) {
376- RETURN_THROWS ();
377- }
378-
379- if (!autoloader_function_autoload_functions ) {
380- RETURN_EMPTY_ARRAY ();
381- }
382-
383- array_init (return_value );
384-
385- ZEND_HASH_FOREACH_PTR (autoloader_function_autoload_functions , func_info ) {
386- zval tmp ;
387- zend_get_callable_zval_from_fcc (func_info , & tmp );
388- add_next_index_zval (return_value , & tmp );
389- } ZEND_HASH_FOREACH_END ();
379+ autoload_list (INTERNAL_FUNCTION_PARAM_PASSTHRU , autoloader_function_autoload_functions );
390380}
391381
392382void zend_autoload_shutdown (void )
0 commit comments