@@ -1667,11 +1667,7 @@ void user_shutdown_function_dtor(zval *zv) /* {{{ */
1667
1667
php_shutdown_function_entry * shutdown_function_entry = Z_PTR_P (zv );
1668
1668
1669
1669
zval_ptr_dtor (& shutdown_function_entry -> fci .function_name );
1670
- for (size_t i = 0 ; i < shutdown_function_entry -> fci .param_count ; i ++ ) {
1671
- zval_ptr_dtor (& shutdown_function_entry -> fci .params [i ]);
1672
- }
1673
-
1674
- efree (shutdown_function_entry -> fci .params );
1670
+ zend_fcall_info_args_clear (& shutdown_function_entry -> fci , true);
1675
1671
efree (shutdown_function_entry );
1676
1672
}
1677
1673
/* }}} */
@@ -1788,25 +1784,20 @@ PHP_FUNCTION(register_shutdown_function)
1788
1784
{
1789
1785
php_shutdown_function_entry entry ;
1790
1786
zval * params ;
1787
+ uint32_t param_count ;
1788
+ bool status ;
1791
1789
1792
1790
ZEND_PARSE_PARAMETERS_START (1 , -1 )
1793
1791
Z_PARAM_FUNC (entry .fci , entry .fci_cache )
1794
- Z_PARAM_VARIADIC ('+' , params , entry . fci . param_count );
1792
+ Z_PARAM_VARIADIC ('+' , params , param_count );
1795
1793
ZEND_PARSE_PARAMETERS_END ();
1796
1794
1797
1795
Z_TRY_ADDREF (entry .fci .function_name );
1796
+ entry .fci .params = NULL ;
1797
+ zend_fcall_info_argp (& entry .fci , param_count , params );
1798
1798
1799
- if (entry .fci .param_count ) {
1800
- entry .fci .params = emalloc (sizeof (zval ) * entry .fci .param_count );
1801
-
1802
- for (size_t i = 0 ; i < entry .fci .param_count ; i ++ ) {
1803
- ZVAL_COPY (& entry .fci .params [i ], & params [i ]);
1804
- }
1805
- } else {
1806
- entry .fci .params = NULL ;
1807
- }
1808
-
1809
- ZEND_ASSERT (append_user_shutdown_function (& entry ));
1799
+ status = append_user_shutdown_function (& entry );
1800
+ ZEND_ASSERT (status );
1810
1801
}
1811
1802
/* }}} */
1812
1803
0 commit comments