REGISTER_INI_ENTRIES();
if (0
+ || SUCCESS != PHP_MINIT_CALL(http_object)
|| SUCCESS != PHP_MINIT_CALL(http_exception)
|| SUCCESS != PHP_MINIT_CALL(http_cookie)
|| SUCCESS != PHP_MINIT_CALL(http_encoding)
static void php_http_client_driver_hash_dtor(zval *pData)
{
- efree(Z_PTR_P(pData));
+ pefree(Z_PTR_P(pData), 1);
}
ZEND_RESULT_CODE php_http_client_driver_add(php_http_client_driver_t *driver)
/* useragent */
if ((opt = php_http_option_register(registry, ZEND_STRL("useragent"), CURLOPT_USERAGENT, IS_STRING))) {
/* don't check strlen, to allow sending no useragent at all */
- ZVAL_STRING(&opt->defval,
+ ZVAL_PSTRING(&opt->defval,
"PECL_HTTP/" PHP_PECL_HTTP_VERSION " "
"PHP/" PHP_VERSION " "
"libcurl/" LIBCURL_VERSION);
}
if ((opt = php_http_option_register(registry, ZEND_STRL("certtype"), CURLOPT_SSLCERTTYPE, IS_STRING))) {
opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_STRLEN;
- ZVAL_STRING(&opt->defval, "PEM");
+ ZVAL_PSTRING(&opt->defval, "PEM");
}
if ((opt = php_http_option_register(registry, ZEND_STRL("key"), CURLOPT_SSLKEY, IS_STRING))) {
opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_STRLEN;
}
if ((opt = php_http_option_register(registry, ZEND_STRL("keytype"), CURLOPT_SSLKEYTYPE, IS_STRING))) {
opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_STRLEN;
- ZVAL_STRING(&opt->defval, "PEM");
+ ZVAL_PSTRING(&opt->defval, "PEM");
}
if ((opt = php_http_option_register(registry, ZEND_STRL("keypasswd"), CURLOPT_SSLKEYPASSWD, IS_STRING))) {
opt->flags |= PHP_HTTP_CURLE_OPTION_CHECK_STRLEN;
static void php_http_message_object_prophandler_hash_dtor(zval *pData)
{
- efree(Z_PTR_P(pData));
+ pefree(Z_PTR_P(pData), 1);
}
typedef void (*php_http_message_object_prophandler_func_t)(php_http_message_object_t *o, zval *v);
#include "php_http_api.h"
+static zend_object_handlers php_http_object_handlers;
+
zend_object *php_http_object_new(zend_class_entry *ce)
{
return &php_http_object_new_ex(ce, NULL)->zo;
object_properties_init(&o->zo, ce);
o->intern = intern;
- o->zo.handlers = zend_get_std_object_handlers();
+ o->zo.handlers = &php_http_object_handlers;
return o;
}
+void php_http_object_free(zend_object *object)
+{
+ php_http_object_t *obj = PHP_HTTP_OBJ(object, NULL);
+ zend_object_std_dtor(object);
+}
+
ZEND_RESULT_CODE php_http_new(void **obj_ptr, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr)
{
void *obj;
return rv;
}
+PHP_MINIT_FUNCTION(http_object)
+{
+ memcpy(&php_http_object_handlers, zend_get_std_object_handlers(), sizeof(php_http_object_handlers));
+ php_http_object_handlers.offset = XtOffsetOf(php_http_object_t, zo);
+
+ return SUCCESS;
+}
+
/*
* Local variables:
* tab-width: 4
ZEND_RESULT_CODE php_http_new(void **obj_ptr, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr);
ZEND_RESULT_CODE php_http_method_call(zval *object, const char *method_str, size_t method_len, int argc, zval argv[], zval *retval_ptr);
+PHP_MINIT_FUNCTION(http_object);
+
#endif
zval_ptr_dtor(&opt->defval);
zend_hash_destroy(&opt->suboptions.options);
zend_string_release(opt->name);
- efree(opt);
+ pefree(opt, opt->persistent);
}
php_http_options_t *php_http_options_init(php_http_options_t *registry, zend_bool persistent)
opt.suboptions.getter = registry->getter;
opt.suboptions.setter = registry->setter;
+ opt.persistent = registry->persistent;
opt.name = zend_string_init(name_str, name_len, registry->persistent);
opt.type = type;
opt.option = option;
ZVAL_LONG(&opt.defval, 0);
break;
- case IS_STRING:
- ZVAL_EMPTY_STRING(&opt.defval);
- break;
-
case IS_DOUBLE:
ZVAL_DOUBLE(&opt.defval, 0);
break;
zval defval;
php_http_option_set_callback_t setter;
+ unsigned persistent:1;
};
PHP_HTTP_API php_http_options_t *php_http_options_init(php_http_options_t *registry, zend_bool persistent);