@@ -1019,13 +1019,12 @@ static HashTable *php_zip_get_properties(zend_object *object)/* {{{ */
1019
1019
/* }}} */
1020
1020
1021
1021
#ifdef HAVE_PROGRESS_CALLBACK
1022
- static void _php_zip_progress_callback_free (void * ptr )
1022
+ static void php_zip_progress_callback_free (void * ptr )
1023
1023
{
1024
1024
ze_zip_object * obj = ptr ;
1025
1025
1026
- if (!Z_ISUNDEF (obj -> progress_callback )) {
1027
- zval_ptr_dtor (& obj -> progress_callback );
1028
- ZVAL_UNDEF (& obj -> progress_callback );
1026
+ if (ZEND_FCC_INITIALIZED (obj -> progress_callback )) {
1027
+ zend_fcc_dtor (& obj -> progress_callback );
1029
1028
}
1030
1029
}
1031
1030
#endif
@@ -1066,7 +1065,7 @@ static void php_zip_object_free_storage(zend_object *object) /* {{{ */
1066
1065
1067
1066
#ifdef HAVE_PROGRESS_CALLBACK
1068
1067
/* if not properly called by libzip */
1069
- _php_zip_progress_callback_free (intern );
1068
+ php_zip_progress_callback_free (intern );
1070
1069
#endif
1071
1070
1072
1071
#ifdef HAVE_CANCEL_CALLBACK
@@ -3019,42 +3018,43 @@ PHP_METHOD(ZipArchive, getStream)
3019
3018
}
3020
3019
3021
3020
#ifdef HAVE_PROGRESS_CALLBACK
3022
- static void _php_zip_progress_callback (zip_t * arch , double state , void * ptr )
3021
+ static void php_zip_progress_callback (zip_t * arch , double state , void * ptr )
3023
3022
{
3024
3023
zval cb_args [1 ];
3025
- zval cb_retval ;
3026
3024
ze_zip_object * obj = ptr ;
3027
3025
3028
3026
ZVAL_DOUBLE (& cb_args [0 ], state );
3029
- if (call_user_function (EG (function_table ), NULL , & obj -> progress_callback , & cb_retval , 1 , cb_args ) == SUCCESS && !Z_ISUNDEF (cb_retval )) {
3030
- zval_ptr_dtor (& cb_retval );
3031
- }
3027
+ zend_call_known_fcc (& obj -> progress_callback , NULL , 1 , cb_args , NULL );
3032
3028
}
3033
3029
3034
3030
/* {{{ register a progression callback: void callback(double state); */
3035
3031
PHP_METHOD (ZipArchive , registerProgressCallback )
3036
3032
{
3037
3033
struct zip * intern ;
3038
- zval * self = ZEND_THIS ;
3039
3034
double rate ;
3040
- zend_fcall_info fci ;
3035
+ zend_fcall_info dummy_fci ;
3041
3036
zend_fcall_info_cache fcc ;
3042
3037
ze_zip_object * obj ;
3043
3038
3044
- if (zend_parse_parameters (ZEND_NUM_ARGS (), "df " , & rate , & fci , & fcc ) == FAILURE ) {
3039
+ if (zend_parse_parameters (ZEND_NUM_ARGS (), "dF " , & rate , & dummy_fci , & fcc ) == FAILURE ) {
3045
3040
RETURN_THROWS ();
3046
3041
}
3047
3042
3048
- ZIP_FROM_OBJECT (intern , self );
3049
-
3050
- obj = Z_ZIP_P (self );
3043
+ /* Inline ZIP_FROM_OBJECT(intern, self); */
3044
+ obj = Z_ZIP_P (ZEND_THIS );
3045
+ intern = obj -> za ;
3046
+ if (!intern ) { \
3047
+ zend_value_error ("Invalid or uninitialized Zip object" );
3048
+ zend_release_fcall_info_cache (& fcc );
3049
+ RETURN_THROWS ();
3050
+ }
3051
3051
3052
3052
/* free if called twice */
3053
- _php_zip_progress_callback_free (obj );
3053
+ php_zip_progress_callback_free (obj );
3054
3054
3055
3055
/* register */
3056
- ZVAL_COPY (& obj -> progress_callback , & fci . function_name );
3057
- if (zip_register_progress_callback_with_state (intern , rate , _php_zip_progress_callback , _php_zip_progress_callback_free , obj )) {
3056
+ zend_fcc_dup (& obj -> progress_callback , & fcc );
3057
+ if (zip_register_progress_callback_with_state (intern , rate , php_zip_progress_callback , php_zip_progress_callback_free , obj )) {
3058
3058
RETURN_FALSE ;
3059
3059
}
3060
3060
0 commit comments