Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions php_memcached.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ typedef struct {
} php_memc_result_callback_ctx_t;

static inline php_memc_object_t *php_memc_fetch_object(zend_object *obj) {
return (php_memc_object_t *)((char *)obj - XtOffsetOf(php_memc_object_t, zo));
return (php_memc_object_t *)((char *)obj - offsetof(php_memc_object_t, zo));
}
#define Z_MEMC_OBJ_P(zv) php_memc_fetch_object(Z_OBJ_P(zv));

Expand Down Expand Up @@ -280,7 +280,7 @@ typedef struct {
} php_memc_server_t;

static inline php_memc_server_t *php_memc_server_fetch_object(zend_object *obj) {
return (php_memc_server_t *)((char *)obj - XtOffsetOf(php_memc_server_t, zo));
return (php_memc_server_t *)((char *)obj - offsetof(php_memc_server_t, zo));
}
#define Z_MEMC_SERVER_P(zv) php_memc_server_fetch_object(Z_OBJ_P(zv))

Expand Down Expand Up @@ -1689,7 +1689,7 @@ static void php_memc_getMulti_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool by_ke
}

if (!retval || EG(exception)) {
zval_dtor(return_value);
zval_ptr_dtor_nogc(return_value);
RETURN_FROM_GET;
}
}
Expand Down Expand Up @@ -1892,7 +1892,7 @@ PHP_METHOD(Memcached, fetchAll)
status = php_memc_result_apply(intern, s_fetch_all_apply, 0, return_value);

if (s_memc_status_handle_result_code(intern, status) == FAILURE) {
zval_dtor(return_value);
zval_ptr_dtor_nogc(return_value);
RETURN_FALSE;
}
}
Expand Down Expand Up @@ -2935,7 +2935,7 @@ PHP_METHOD(Memcached, getVersion)
array_init(return_value);
status = memcached_server_cursor(intern->memc, callbacks, return_value, 1);
if (s_memc_status_handle_result_code(intern, status) == FAILURE) {
zval_dtor(return_value);
zval_ptr_dtor_nogc(return_value);
RETURN_FALSE;
}
}
Expand Down Expand Up @@ -2977,7 +2977,7 @@ PHP_METHOD(Memcached, getAllKeys)
*/
if (rc != MEMCACHED_CLIENT_ERROR && rc != MEMCACHED_SERVER_ERROR
&& s_memc_status_handle_result_code(intern, rc) == FAILURE) {
zval_dtor(return_value);
zval_ptr_dtor_nogc(return_value);
RETURN_FALSE;
}
}
Expand Down Expand Up @@ -4404,7 +4404,7 @@ PHP_MINIT_FUNCTION(memcached)
zend_class_entry ce;

memcpy(&memcached_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
memcached_object_handlers.offset = XtOffsetOf(php_memc_object_t, zo);
memcached_object_handlers.offset = offsetof(php_memc_object_t, zo);
memcached_object_handlers.clone_obj = NULL;
memcached_object_handlers.free_obj = php_memc_object_free_storage;

Expand All @@ -4415,7 +4415,7 @@ PHP_MINIT_FUNCTION(memcached)

#ifdef HAVE_MEMCACHED_PROTOCOL
memcpy(&memcached_server_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
memcached_server_object_handlers.offset = XtOffsetOf(php_memc_server_t, zo);
memcached_server_object_handlers.offset = offsetof(php_memc_server_t, zo);
memcached_server_object_handlers.clone_obj = NULL;
memcached_server_object_handlers.free_obj = php_memc_server_free_storage;

Expand Down
12 changes: 9 additions & 3 deletions php_memcached_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,15 +324,21 @@ PS_OPEN_FUNC(memcached)

memcached_server_list_st servers;

#if PHP_VERSION_ID >= 80600
const char *save_path_str = ZSTR_VAL(save_path);
#else
const char *save_path_str = save_path;
#endif

// Fail on incompatible PERSISTENT identifier (removed in php-memcached 3.0)
if (strstr(save_path, "PERSISTENT=")) {
if (strstr(save_path_str, "PERSISTENT=")) {
php_error_docref(NULL, E_WARNING, "failed to parse session.save_path: PERSISTENT is replaced by memcached.sess_persistent = On");
PS_SET_MOD_DATA(NULL);
return FAILURE;
}

// First parse servers
servers = memcached_servers_parse(save_path);
servers = memcached_servers_parse(save_path_str);

if (!servers) {
php_error_docref(NULL, E_WARNING, "failed to parse session.save_path");
Expand All @@ -343,7 +349,7 @@ PS_OPEN_FUNC(memcached)
if (MEMC_SESS_INI(persistent_enabled)) {
zend_resource *le_p;

plist_key_len = spprintf(&plist_key, 0, "memc-session:%s", save_path);
plist_key_len = spprintf(&plist_key, 0, "memc-session:%s", save_path_str);

if ((le_p = zend_hash_str_find_ptr(&EG(persistent_list), plist_key, plist_key_len)) != NULL) {
if (le_p->type == s_memc_sess_list_entry()) {
Expand Down
Loading