static int php_http_client_datashare_compare_handles(void *h1, void *h2);
-PHP_HTTP_API php_http_client_datashare_t *php_http_client_datashare_init(php_http_client_datashare_t *h, php_http_client_datashare_ops_t *ops, php_http_resource_factory_t *rf, void *init_arg TSRMLS_DC)
+PHP_HTTP_API php_http_client_datashare_t *php_http_client_datashare_init(php_http_client_datashare_t *h, php_http_client_datashare_ops_t *ops, php_resource_factory_t *rf, void *init_arg TSRMLS_DC)
{
php_http_client_datashare_t *free_h = NULL;
if (!h) {
free_h = h = emalloc(sizeof(*h));
}
- memset(h, sizeof(*h), 0);
+ memset(h, 0, sizeof(*h));
zend_llist_init(&h->clients, sizeof(zval *), ZVAL_PTR_DTOR, 0);
h->ops = ops;
if (rf) {
h->rf = rf;
} else if (ops->rsrc) {
- h->rf = php_http_resource_factory_init(NULL, h->ops->rsrc, h, NULL);
+ h->rf = php_resource_factory_init(NULL, h->ops->rsrc, h, NULL);
}
TSRMLS_SET_CTX(h->ts);
h->ops->dtor(h);
}
zend_llist_destroy(&h->clients);
- php_http_resource_factory_free(&h->rf);
+ php_resource_factory_free(&h->rf);
}
PHP_HTTP_API void php_http_client_datashare_free(php_http_client_datashare_t **h)
PHP_HTTP_ARG_OBJ(http\\Client, client, 0)
PHP_HTTP_END_ARGS;
-static void php_http_client_datashare_object_write_prop(zval *object, zval *member, zval *value, const zend_literal *literal_key TSRMLS_DC);
+static void php_http_client_datashare_object_write_prop(zval *object, zval *member, zval *value PHP_HTTP_ZEND_LITERAL_DC TSRMLS_DC);
static zend_class_entry *php_http_client_datashare_class_entry;
efree(o);
}
-static void php_http_client_datashare_object_write_prop(zval *object, zval *member, zval *value, const zend_literal *literal_key TSRMLS_DC)
+static void php_http_client_datashare_object_write_prop(zval *object, zval *member, zval *value PHP_HTTP_ZEND_LITERAL_DC TSRMLS_DC)
{
zend_property_info *pi;
}
}
- zend_get_std_object_handlers()->write_property(object, member, value, literal_key TSRMLS_CC);
+ zend_get_std_object_handlers()->write_property(object, member, value PHP_HTTP_ZEND_LITERAL_CC TSRMLS_CC);
}
-static zval **php_http_client_datashare_object_get_prop_ptr(zval *object, zval *member, const zend_literal *literal_key TSRMLS_DC)
+static zval **php_http_client_datashare_object_get_prop_ptr(zval *object, zval *member PHP_HTTP_ZEND_LITERAL_DC TSRMLS_DC)
{
zend_property_info *pi;
return &php_http_property_proxy_init(NULL, object, member, NULL TSRMLS_CC)->myself;
}
- return zend_get_std_object_handlers()->get_property_ptr_ptr(object, member, literal_key TSRMLS_CC);
+ return zend_get_std_object_handlers()->get_property_ptr_ptr(object, member PHP_HTTP_ZEND_LITERAL_CC TSRMLS_CC);
}
RETURN_FALSE;
}
+PHP_METHOD(HttpClientDataShare, __sleep)
+{
+ php_http_error(HE_THROW, PHP_HTTP_E_CLIENT_DATASHARE, "cannot serialize a client datashare");
+}
+
PHP_MINIT_FUNCTION(http_client_datashare)
{
- PHP_HTTP_REGISTER_CLASS(http\\Client\\DataShare, AbstractDataShare, http_client_datashare, php_http_object_class_entry, 0);
+ PHP_HTTP_REGISTER_CLASS(http\\Client\\DataShare, AbstractDataShare, http_client_datashare, php_http_object_get_class_entry(), ZEND_ACC_EXPLICIT_ABSTRACT_CLASS);
php_http_client_datashare_class_entry->create_object = php_http_client_datashare_object_new;
memcpy(&php_http_client_datashare_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
php_http_client_datashare_object_handlers.clone_obj = NULL;