@@ -170,7 +170,7 @@ typedef struct {
170
170
} php_memc_t ;
171
171
172
172
static inline php_memc_t * php_memc_fetch_object (zend_object * obj ) {
173
- return (php_memc_t * )((char * )( obj ) - XtOffsetOf (php_memc_t , zo ));
173
+ return (php_memc_t * )((char * )obj - XtOffsetOf (php_memc_t , zo ));
174
174
}
175
175
#define Z_MEMC_OBJ_P (zv ) php_memc_fetch_object(Z_OBJ_P(zv));
176
176
@@ -356,20 +356,17 @@ char *php_memc_printable_func (zend_fcall_info *fci, zend_fcall_info_cache *fci_
356
356
static zend_bool php_memcached_on_new_callback (zval * object , zend_fcall_info * fci , zend_fcall_info_cache * fci_cache , zend_string * persistent_id )
357
357
{
358
358
zend_bool ret = 1 ;
359
- zval retval ;
360
- zval params [2 ];
359
+ zval retval , id ;
361
360
362
361
if (persistent_id ) {
363
- ZVAL_STR (& params [ 1 ] , persistent_id );
362
+ ZVAL_STR (& id , persistent_id );
364
363
} else {
365
- ZVAL_NULL (& params [ 1 ] );
364
+ ZVAL_NULL (& id );
366
365
}
367
366
368
- /* Call the cb */
369
- ZVAL_COPY (& params [0 ], object );
367
+ ZVAL_UNDEF (& retval );
370
368
371
- fci -> params = params ;
372
- fci -> param_count = 2 ;
369
+ zend_fcall_info_argn (fci , 2 , object , & id );
373
370
fci -> retval = & retval ;
374
371
fci -> no_separation = 1 ;
375
372
@@ -379,10 +376,12 @@ static zend_bool php_memcached_on_new_callback(zval *object, zend_fcall_info *fc
379
376
efree (buf );
380
377
ret = 0 ;
381
378
}
379
+
380
+ if (Z_TYPE (retval ) != IS_UNDEF )
381
+ zval_ptr_dtor (& retval );
382
+
383
+ zend_fcall_info_args_clear (fci , 1 );
382
384
383
- zval_ptr_dtor (& params [0 ]);
384
- zval_ptr_dtor (& params [1 ]);
385
- zval_ptr_dtor (& retval );
386
385
return ret ;
387
386
}
388
387
@@ -408,7 +407,6 @@ static PHP_METHOD(Memcached, __construct)
408
407
zend_fcall_info_cache fci_cache ;
409
408
410
409
if (zend_parse_parameters (ZEND_NUM_ARGS (), "|S!f!S" , & persistent_id , & fci , & fci_cache , & conn_str ) == FAILURE ) {
411
- ZEND_CTOR_MAKE_NULL ();
412
410
return ;
413
411
}
414
412
@@ -3304,6 +3302,7 @@ zend_bool s_unserialize_value (enum memcached_serializer serializer, int val_typ
3304
3302
3305
3303
PHP_VAR_UNSERIALIZE_INIT (var_hash );
3306
3304
if (!php_var_unserialize (value , (const unsigned char * * )& payload_tmp , (const unsigned char * )payload_tmp + payload_len , & var_hash )) {
3305
+ zval_ptr_dtor (value );
3307
3306
ZVAL_FALSE (value );
3308
3307
PHP_VAR_UNSERIALIZE_DESTROY (var_hash );
3309
3308
php_error_docref (NULL , E_WARNING , "could not unserialize value" );
@@ -3538,6 +3537,7 @@ static memcached_return php_memc_do_cache_callback(zval *zmemc_obj, zend_fcall_i
3538
3537
fci -> param_count = 4 ;
3539
3538
3540
3539
result = zend_call_function (fci , fcc );
3540
+
3541
3541
ZVAL_DUP (value , Z_REFVAL (z_val ));
3542
3542
expiration = Z_REFVAL (z_expiration );
3543
3543
if (result == SUCCESS && Z_TYPE (retval ) != IS_UNDEF ) {
0 commit comments