From: Michael Wallner Date: Tue, 3 Apr 2012 10:00:01 +0000 (+0000) Subject: code cleanup X-Git-Tag: RELEASE_2_1_0_RC3~10^2^2~142 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=bd80b17b026a00a254ee8693cd7bacf1ebdec4cf code cleanup --- diff --git a/php_http.h b/php_http.h index 1fe67e9..97c81f7 100644 --- a/php_http.h +++ b/php_http.h @@ -15,10 +15,10 @@ #define PHP_HTTP_EXT_VERSION "2.0.0dev10" -extern zend_module_entry http_module_entry; +zend_module_entry http_module_entry; #define phpext_http_ptr &http_module_entry -extern int http_module_number; +int http_module_number; #endif /* PHP_EXT_HTTP_H */ diff --git a/php_http_client.c b/php_http_client.c index 06e90ba..6f1c5fa 100644 --- a/php_http_client.c +++ b/php_http_client.c @@ -318,10 +318,10 @@ static inline zend_object_value php_http_client_object_message(zval *this_ptr, p if (Z_STRLEN_P(zcn) && (class_entry = zend_fetch_class(Z_STRVAL_P(zcn), Z_STRLEN_P(zcn), 0 TSRMLS_CC)) - && (SUCCESS == php_http_new(&ov, class_entry, (php_http_new_t) php_http_message_object_new_ex, php_http_client_response_class_entry, msg, NULL TSRMLS_CC))) { + && (SUCCESS == php_http_new(&ov, class_entry, (php_http_new_t) php_http_message_object_new_ex, php_http_client_response_get_class_entry(), msg, NULL TSRMLS_CC))) { return ov; } else { - return php_http_message_object_new_ex(php_http_client_response_class_entry, msg, NULL TSRMLS_CC); + return php_http_message_object_new_ex(php_http_client_response_get_class_entry(), msg, NULL TSRMLS_CC); } } @@ -441,7 +441,7 @@ STATUS php_http_client_object_handle_response(zval *zclient TSRMLS_DC) /* update the actual request message */ MAKE_STD_ZVAL(message); - ZVAL_OBJVAL(message, php_http_message_object_new_ex(php_http_message_class_entry, php_http_message_copy_ex(msg, NULL, 0), NULL TSRMLS_CC), 0); + ZVAL_OBJVAL(message, php_http_message_object_new_ex(php_http_message_get_class_entry(), php_http_message_copy_ex(msg, NULL, 0), NULL TSRMLS_CC), 0); zend_update_property(php_http_client_class_entry, zclient, ZEND_STRL("requestMessage"), message TSRMLS_CC); zval_ptr_dtor(&message); } @@ -543,7 +543,7 @@ void php_http_client_options_set_subr(zval *this_ptr, char *key, size_t len, zva void php_http_client_options_get_subr(zval *this_ptr, char *key, size_t len, zval *return_value TSRMLS_DC) { zend_class_entry *this_ce = Z_OBJCE_P(getThis()); - zval **options, *opts = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("options"), 0 TSRMLS_CC); + zval **options, *opts = zend_read_property(this_ce, getThis(), ZEND_STRL("options"), 0 TSRMLS_CC); if ((Z_TYPE_P(opts) == IS_ARRAY) && (SUCCESS == zend_symtable_find(Z_ARRVAL_P(opts), key, len, (void *) &options))) { RETVAL_ZVAL(*options, 1, 0); @@ -552,7 +552,7 @@ void php_http_client_options_get_subr(zval *this_ptr, char *key, size_t len, zva PHP_METHOD(HttpClient, __construct) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { zval *os, *opts = NULL; MAKE_STD_ZVAL(os); @@ -569,7 +569,7 @@ PHP_METHOD(HttpClient, __construct) PHP_METHOD(HttpClient, getObservers) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters_none()) { RETVAL_PROP(php_http_client_class_entry, "observers"); } @@ -802,7 +802,7 @@ PHP_METHOD(HttpClient, flushCookies) PHP_METHOD(HttpClient, getResponseMessage) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters_none()) { zval *message = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("responseMessage"), 0 TSRMLS_CC); @@ -817,7 +817,7 @@ PHP_METHOD(HttpClient, getResponseMessage) PHP_METHOD(HttpClient, getRequestMessage) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters_none()) { zval *message = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("requestMessage"), 0 TSRMLS_CC); @@ -832,7 +832,7 @@ PHP_METHOD(HttpClient, getRequestMessage) PHP_METHOD(HttpClient, getHistory) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters_none()) { zval *hist = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("history"), 0 TSRMLS_CC); @@ -895,7 +895,7 @@ PHP_METHOD(HttpClient, send) RETVAL_FALSE; - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O!", &zreq, php_http_client_request_get_class_entry())) { if (SUCCESS == php_http_client_object_handle_request(getThis(), &zreq TSRMLS_CC)) { php_http_client_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); @@ -917,12 +917,12 @@ PHP_METHOD(HttpClient, send) PHP_MINIT_FUNCTION(http_client) { - PHP_HTTP_REGISTER_CLASS(http\\Client, AbstractClient, http_client, php_http_object_class_entry, ZEND_ACC_ABSTRACT); + PHP_HTTP_REGISTER_CLASS(http\\Client, AbstractClient, http_client, php_http_object_get_class_entry(), ZEND_ACC_ABSTRACT); php_http_client_class_entry->create_object = php_http_client_object_new; memcpy(&php_http_client_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_http_client_object_handlers.clone_obj = php_http_client_object_clone; - zend_class_implements(php_http_client_class_entry TSRMLS_CC, 2, spl_ce_SplSubject, php_http_client_interface_class_entry); + zend_class_implements(php_http_client_class_entry TSRMLS_CC, 2, spl_ce_SplSubject, php_http_client_interface_get_class_entry()); zend_declare_property_string(php_http_client_class_entry, ZEND_STRL("responseMessageClass"), "", ZEND_ACC_PRIVATE TSRMLS_CC); zend_declare_property_null(php_http_client_class_entry, ZEND_STRL("observers"), ZEND_ACC_PRIVATE TSRMLS_CC); diff --git a/php_http_client_datashare.c b/php_http_client_datashare.c index 38719ec..09d568f 100644 --- a/php_http_client_datashare.c +++ b/php_http_client_datashare.c @@ -325,7 +325,7 @@ PHP_METHOD(HttpClientDataShare, reset) 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(), 0); 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; diff --git a/php_http_client_factory.c b/php_http_client_factory.c index aba4b64..a705211 100644 --- a/php_http_client_factory.c +++ b/php_http_client_factory.c @@ -35,7 +35,7 @@ PHP_HTTP_API STATUS php_http_client_factory_get_driver(const char *name_str, siz return FAILURE; } -static zend_class_entry *php_http_client_factory_get_class_entry(zval *this_ptr, const char *for_str, size_t for_len TSRMLS_DC) +static zend_class_entry *php_http_client_factory_find_class_entry(zval *this_ptr, const char *for_str, size_t for_len TSRMLS_DC) { /* stupid non-const api */ char *sc = estrndup(for_str, for_len); @@ -74,8 +74,14 @@ PHP_HTTP_END_ARGS; PHP_HTTP_EMPTY_ARGS(getDriver); PHP_HTTP_EMPTY_ARGS(getAvailableDrivers); -zend_class_entry *php_http_client_factory_class_entry; -zend_function_entry php_http_client_factory_method_entry[] = { +static zend_class_entry *php_http_client_factory_class_entry; + +zend_class_entry *php_http_client_factory_get_class_entry(void) +{ + return php_http_client_factory_class_entry; +} + +static zend_function_entry php_http_client_factory_method_entry[] = { PHP_HTTP_REQUEST_FACTORY_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_HTTP_REQUEST_FACTORY_ME(createClient, ZEND_ACC_PUBLIC) PHP_HTTP_REQUEST_FACTORY_ME(createPool, ZEND_ACC_PUBLIC) @@ -88,7 +94,7 @@ zend_function_entry php_http_client_factory_method_entry[] = { PHP_METHOD(HttpClientFactory, __construct) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { HashTable *options = NULL; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|h", &options)) { @@ -113,9 +119,9 @@ PHP_METHOD(HttpClientFactory, createClient) { zval *options = NULL; - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!", &options)) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { zval *zdriver; zend_object_value ov; zend_class_entry *class_entry = NULL; @@ -144,7 +150,7 @@ PHP_METHOD(HttpClientFactory, createClient) req = php_http_client_init(NULL, driver.client_ops, rf, NULL TSRMLS_CC); if (req) { - if (!(class_entry = php_http_client_factory_get_class_entry(getThis(), ZEND_STRL("clientClass") TSRMLS_CC))) { + if (!(class_entry = php_http_client_factory_find_class_entry(getThis(), ZEND_STRL("clientClass") TSRMLS_CC))) { class_entry = driver.client_ops->class_entry(); } @@ -170,9 +176,9 @@ PHP_METHOD(HttpClientFactory, createPool) int argc = 0; zval ***argv; - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|*", &argv, &argc)) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { int i; zval *zdriver; zend_object_value ov; @@ -201,7 +207,7 @@ PHP_METHOD(HttpClientFactory, createPool) pool = php_http_client_pool_init(NULL, driver.client_pool_ops, rf, NULL TSRMLS_CC); if (pool) { - if (!(class_entry = php_http_client_factory_get_class_entry(getThis(), ZEND_STRL("clientPoolClass") TSRMLS_CC))) { + if (!(class_entry = php_http_client_factory_find_class_entry(getThis(), ZEND_STRL("clientPoolClass") TSRMLS_CC))) { class_entry = driver.client_pool_ops->class_entry(); } @@ -231,9 +237,9 @@ PHP_METHOD(HttpClientFactory, createDataShare) int argc = 0; zval ***argv; - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|*", &argv, &argc)) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { int i; zval *zdriver; zend_object_value ov; @@ -262,7 +268,7 @@ PHP_METHOD(HttpClientFactory, createDataShare) share = php_http_client_datashare_init(NULL, driver.client_datashare_ops, rf, NULL TSRMLS_CC); if (share) { - if (!(class_entry = php_http_client_factory_get_class_entry(getThis(), ZEND_STRL("clientDataShareClass") TSRMLS_CC))) { + if (!(class_entry = php_http_client_factory_find_class_entry(getThis(), ZEND_STRL("clientDataShareClass") TSRMLS_CC))) { class_entry = driver.client_datashare_ops->class_entry(); } @@ -314,7 +320,7 @@ PHP_MINIT_FUNCTION(http_client_factory) { zend_hash_init(&php_http_client_factory_drivers, 0, NULL, NULL, 1); - PHP_HTTP_REGISTER_CLASS(http\\Client, Factory, http_client_factory, php_http_object_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http\\Client, Factory, http_client_factory, php_http_object_get_class_entry(), 0); php_http_client_factory_class_entry->create_object = php_http_client_factory_new; zend_declare_property_stringl(php_http_client_factory_class_entry, ZEND_STRL("driver"), ZEND_STRL("curl"), ZEND_ACC_PROTECTED TSRMLS_CC); diff --git a/php_http_client_factory.h b/php_http_client_factory.h index a31663d..ffa4f8e 100644 --- a/php_http_client_factory.h +++ b/php_http_client_factory.h @@ -26,8 +26,7 @@ typedef struct php_http_client_factory_driver { PHP_HTTP_API STATUS php_http_client_factory_add_driver(const char *name_str, size_t name_len, php_http_client_factory_driver_t *driver); PHP_HTTP_API STATUS php_http_client_factory_get_driver(const char *name_str, size_t name_len, php_http_client_factory_driver_t *driver); -extern zend_class_entry *php_http_client_factory_class_entry; -extern zend_function_entry php_http_client_factory_method_entry[]; +zend_class_entry *php_http_client_factory_get_class_entry(void); #define php_http_client_factory_new php_http_object_new diff --git a/php_http_client_interface.c b/php_http_client_interface.c index 6912508..3040e76 100644 --- a/php_http_client_interface.c +++ b/php_http_client_interface.c @@ -15,16 +15,21 @@ #define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpClient, method, 0, req_args) #define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpClient, method, 0) -#define PHP_HTTP_CLIENT_ME(method, visibility) PHP_ME(HttpClient, method, PHP_HTTP_ARGS(HttpClient, method), visibility) +#define PHP_HTTP_CLIENT_ME(method) PHP_ABSTRACT_ME(HttpClient, method, PHP_HTTP_ARGS(HttpClient, method)) PHP_HTTP_BEGIN_ARGS(send, 1) PHP_HTTP_ARG_VAL(request, 0) PHP_HTTP_END_ARGS; -zend_class_entry *php_http_client_interface_class_entry; +static zend_class_entry *php_http_client_interface_class_entry; + +zend_class_entry *php_http_client_interface_get_class_entry(void) +{ + return php_http_client_interface_class_entry; +} zend_function_entry php_http_client_interface_method_entry[] = { - PHP_HTTP_CLIENT_ME(send, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT) + PHP_HTTP_CLIENT_ME(send) {NULL, NULL, NULL} }; diff --git a/php_http_client_interface.h b/php_http_client_interface.h index 797945a..2bbd736 100644 --- a/php_http_client_interface.h +++ b/php_http_client_interface.h @@ -10,10 +10,9 @@ +--------------------------------------------------------------------+ */ -#ifndef PHP_HTTP_CLIENT_H +#ifndef PHP_HTTP_CLIENT_INTERFACE_H -extern zend_class_entry *php_http_client_interface_class_entry; -extern zend_function_entry php_http_client_interface_method_entry[]; +zend_class_entry *php_http_client_interface_get_class_entry(void); PHP_MINIT_FUNCTION(http_client_interface); diff --git a/php_http_client_pool.c b/php_http_client_pool.c index a3fbf5e..5eba4c7 100644 --- a/php_http_client_pool.c +++ b/php_http_client_pool.c @@ -376,11 +376,11 @@ PHP_METHOD(HttpClientPool, reset) PHP_METHOD(HttpClientPool, attach) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { zval *request; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &request, php_http_client_get_class_entry())) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { php_http_client_pool_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); if (obj->iterator.pos > 0 && obj->iterator.pos < zend_llist_count(&obj->pool->clients.attached)) { @@ -399,11 +399,11 @@ PHP_METHOD(HttpClientPool, detach) { RETVAL_FALSE; - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { zval *request; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &request, php_http_client_get_class_entry())) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { php_http_client_pool_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); obj->iterator.pos = -1; @@ -419,9 +419,9 @@ PHP_METHOD(HttpClientPool, send) { RETVAL_FALSE; - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters_none()) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { php_http_client_pool_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); php_http_client_pool_exec(obj->pool); @@ -582,7 +582,7 @@ PHP_METHOD(HttpClientPool, enableEvents) PHP_MINIT_FUNCTION(http_client_pool) { - PHP_HTTP_REGISTER_CLASS(http\\Client\\Pool, AbstractPool, http_client_pool, php_http_object_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http\\Client\\Pool, AbstractPool, http_client_pool, php_http_object_get_class_entry(), 0); php_http_client_pool_class_entry->create_object = php_http_client_pool_object_new; memcpy(&php_http_client_pool_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_http_client_pool_object_handlers.clone_obj = NULL; diff --git a/php_http_client_request.c b/php_http_client_request.c index 3059444..c073512 100644 --- a/php_http_client_request.c +++ b/php_http_client_request.c @@ -83,8 +83,8 @@ PHP_METHOD(HttpClientRequest, __construct) int meth_len = 0, url_len = 0; zval *zheaders = NULL, *zbody = NULL; - with_error_handling(EH_THROW, php_http_exception_class_entry) { - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!a!O!", &meth_str, &meth_len, &url_str, &url_len, &zheaders, &zbody, php_http_message_body_class_entry)) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!a!O!", &meth_str, &meth_len, &url_str, &url_len, &zheaders, &zbody, php_http_message_body_get_class_entry())) { php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); if (obj->message) { @@ -217,7 +217,6 @@ PHP_METHOD(HttpClientRequest, addQuery) if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &qdata)) { php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); php_url *old_url = NULL, new_url = {NULL}; - char empty[] = ""; zval arr, str; @@ -295,7 +294,7 @@ PHP_METHOD(HttpClientRequest, getSslOptions) PHP_MINIT_FUNCTION(http_client_request) { - PHP_HTTP_REGISTER_CLASS(http\\Client, Request, http_client_request, php_http_message_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http\\Client, Request, http_client_request, php_http_message_get_class_entry(), 0); zend_declare_property_null(php_http_client_request_class_entry, ZEND_STRL("options"), ZEND_ACC_PROTECTED TSRMLS_CC); diff --git a/php_http_client_response.c b/php_http_client_response.c index 663ce8b..675f600 100644 --- a/php_http_client_response.c +++ b/php_http_client_response.c @@ -62,7 +62,7 @@ PHP_METHOD(HttpClientResponse, getCookies) zval *cookie; MAKE_STD_ZVAL(cookie); - ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_class_entry, list, NULL TSRMLS_CC), 0); + ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_get_class_entry(), list, NULL TSRMLS_CC), 0); add_next_index_zval(return_value, cookie); } zval_ptr_dtor(&data); @@ -73,7 +73,7 @@ PHP_METHOD(HttpClientResponse, getCookies) zval *cookie; MAKE_STD_ZVAL(cookie); - ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_class_entry, list, NULL TSRMLS_CC), 0); + ZVAL_OBJVAL(cookie, php_http_cookie_object_new_ex(php_http_cookie_get_class_entry(), list, NULL TSRMLS_CC), 0); add_next_index_zval(return_value, cookie); } zval_ptr_dtor(&data); @@ -94,15 +94,21 @@ PHP_METHOD(HttpClientResponse, getCookies) } -zend_class_entry *php_http_client_response_class_entry; -zend_function_entry php_http_client_response_method_entry[] = { +static zend_class_entry *php_http_client_response_class_entry; + +zend_class_entry *php_http_client_response_get_class_entry(void) +{ + return php_http_client_response_class_entry; +} + +static zend_function_entry php_http_client_response_method_entry[] = { PHP_HTTP_CLIENT_RESPONSE_ME(getCookies, ZEND_ACC_PUBLIC) EMPTY_FUNCTION_ENTRY }; PHP_MINIT_FUNCTION(http_client_response) { - PHP_HTTP_REGISTER_CLASS(http\\Client, Response, http_client_response, php_http_message_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http\\Client, Response, http_client_response, php_http_message_get_class_entry(), 0); return SUCCESS; } diff --git a/php_http_client_response.h b/php_http_client_response.h index 704f727..4a304ed 100644 --- a/php_http_client_response.h +++ b/php_http_client_response.h @@ -13,8 +13,7 @@ #ifndef PHP_HTTP_CLIENT_RESPONSE_H #define PHP_HTTP_CLIENT_RESPONSE_H -extern zend_class_entry *php_http_client_response_class_entry; -extern zend_function_entry php_http_client_response_method_entry[]; +zend_class_entry *php_http_client_response_get_class_entry(void); PHP_METHOD(HttpClientResponse, getCookies); diff --git a/php_http_cookie.c b/php_http_cookie.c index d46f414..ef0947e 100644 --- a/php_http_cookie.c +++ b/php_http_cookie.c @@ -425,8 +425,14 @@ PHP_HTTP_BEGIN_ARGS(getExtra, 1) PHP_HTTP_ARG_VAL(name, 0) PHP_HTTP_END_ARGS; -zend_class_entry *php_http_cookie_class_entry; -zend_function_entry php_http_cookie_method_entry[] = { +static zend_class_entry *php_http_cookie_class_entry; + +zend_class_entry *php_http_cookie_get_class_entry(void) +{ + return php_http_cookie_class_entry; +} + +static zend_function_entry php_http_cookie_method_entry[] = { PHP_HTTP_COOKIE_ME(__construct, ZEND_ACC_PUBLIC) PHP_HTTP_COOKIE_ME(getCookies, ZEND_ACC_PUBLIC) PHP_HTTP_COOKIE_ME(setCookies, ZEND_ACC_PUBLIC) @@ -512,14 +518,14 @@ void php_http_cookie_object_free(void *object TSRMLS_DC) PHP_METHOD(HttpCookie, __construct) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { zval *zcookie = NULL; long flags = 0; HashTable *allowed_extras = NULL; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!lH", &zcookie, &flags, &allowed_extras)) { if (zcookie) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { char **ae = NULL; php_http_cookie_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); @@ -938,7 +944,7 @@ PHP_METHOD(HttpCookie, toArray) PHP_MINIT_FUNCTION(http_cookie) { - PHP_HTTP_REGISTER_CLASS(http, Cookie, http_cookie, php_http_object_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http, Cookie, http_cookie, php_http_object_get_class_entry(), 0); php_http_cookie_class_entry->create_object = php_http_cookie_object_new; memcpy(&php_http_cookie_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_http_cookie_object_handlers.clone_obj = php_http_cookie_object_clone; diff --git a/php_http_cookie.h b/php_http_cookie.h index 340084d..d524fee 100644 --- a/php_http_cookie.h +++ b/php_http_cookie.h @@ -55,8 +55,7 @@ PHP_HTTP_API php_http_cookie_list_t *php_http_cookie_list_from_struct(php_http_c PHP_HTTP_API void php_http_cookie_list_to_struct(php_http_cookie_list_t *list, zval *strct); -extern zend_class_entry *php_http_cookie_class_entry; -extern zend_function_entry php_http_cookie_method_entry[]; +zend_class_entry *php_http_cookie_get_class_entry(void); typedef struct php_http_cookie_object { zend_object o; diff --git a/php_http_curl.h b/php_http_curl.h index 709ba22..f7116cd 100644 --- a/php_http_curl.h +++ b/php_http_curl.h @@ -18,8 +18,8 @@ #include #define PHP_HTTP_CURL_VERSION(x, y, z) (LIBCURL_VERSION_NUM >= (((x)<<16) + ((y)<<8) + (z))) -extern PHP_MINIT_FUNCTION(http_curl); -extern PHP_MSHUTDOWN_FUNCTION(http_curl); +PHP_MINIT_FUNCTION(http_curl); +PHP_MSHUTDOWN_FUNCTION(http_curl); #endif /* PHP_HTTP_HAVE_CURL */ diff --git a/php_http_curl_client.c b/php_http_curl_client.c index a2e0d3f..ce47f6b 100644 --- a/php_http_curl_client.c +++ b/php_http_curl_client.c @@ -1024,7 +1024,7 @@ static STATUS php_http_curl_client_reset(php_http_client_t *h) return SUCCESS; } -STATUS php_http_curl_client_prepare(php_http_client_t *h, php_http_message_t *msg) +PHP_HTTP_API STATUS php_http_curl_client_prepare(php_http_client_t *h, php_http_message_t *msg) { size_t body_size; php_http_curl_client_t *curl = h->ctx; @@ -1245,11 +1245,6 @@ static php_http_resource_factory_ops_t php_http_curl_client_resource_factory_ops php_http_curl_dtor }; -static zend_class_entry *get_class_entry(void) -{ - return php_http_curl_client_class_entry; -} - static php_http_client_ops_t php_http_curl_client_ops = { &php_http_curl_client_resource_factory_ops, php_http_curl_client_init, @@ -1260,7 +1255,7 @@ static php_http_client_ops_t php_http_curl_client_ops = { php_http_curl_client_setopt, php_http_curl_client_getopt, (php_http_new_t) php_http_curl_client_object_new_ex, - get_class_entry + php_http_curl_client_get_class_entry }; PHP_HTTP_API php_http_client_ops_t *php_http_curl_client_get_ops(void) @@ -1278,8 +1273,14 @@ PHP_HTTP_BEGIN_ARGS(send, 1) PHP_HTTP_ARG_VAL(request, 0) PHP_HTTP_END_ARGS; -zend_class_entry *php_http_curl_client_class_entry; -zend_function_entry php_http_curl_client_method_entry[] = { +static zend_class_entry *php_http_curl_client_class_entry; + +zend_class_entry *php_http_curl_client_get_class_entry(void) +{ + return php_http_curl_client_class_entry; +} + +static zend_function_entry php_http_curl_client_method_entry[] = { PHP_HTTP_CURL_CLIENT_CLIENT_MALIAS(send, ZEND_ACC_PUBLIC) EMPTY_FUNCTION_ENTRY }; diff --git a/php_http_curl_client.h b/php_http_curl_client.h index b3d8a4a..4baddf1 100644 --- a/php_http_curl_client.h +++ b/php_http_curl_client.h @@ -61,13 +61,12 @@ static inline php_http_curl_client_storage_t *get_storage(CURL *ch) { return st; } -extern STATUS php_http_curl_client_prepare(php_http_client_t *h, php_http_message_t *msg); +PHP_HTTP_API STATUS php_http_curl_client_prepare(php_http_client_t *h, php_http_message_t *msg); -extern zend_class_entry *php_http_curl_client_class_entry; -extern zend_function_entry php_http_curl_client_method_entry[]; +zend_class_entry *php_http_curl_client_get_class_entry(void); -extern zend_object_value php_http_curl_client_object_new(zend_class_entry *ce TSRMLS_DC); -extern zend_object_value php_http_curl_client_object_new_ex(zend_class_entry *ce, php_http_client_t *r, php_http_client_object_t **ptr TSRMLS_DC); +zend_object_value php_http_curl_client_object_new(zend_class_entry *ce TSRMLS_DC); +zend_object_value php_http_curl_client_object_new_ex(zend_class_entry *ce, php_http_client_t *r, php_http_client_object_t **ptr TSRMLS_DC); PHP_MINIT_FUNCTION(http_curl_client); diff --git a/php_http_curl_client_datashare.c b/php_http_curl_client_datashare.c index 1b47eb5..cc370ba 100644 --- a/php_http_curl_client_datashare.c +++ b/php_http_curl_client_datashare.c @@ -136,11 +136,6 @@ static php_http_resource_factory_ops_t php_http_curlsh_resource_factory_ops = { php_http_curlsh_dtor }; -static zend_class_entry *get_class_entry(void) -{ - return php_http_curl_client_datashare_class_entry; -} - static php_http_client_datashare_ops_t php_http_curl_client_datashare_ops = { &php_http_curlsh_resource_factory_ops, php_http_curl_client_datashare_init, @@ -151,7 +146,7 @@ static php_http_client_datashare_ops_t php_http_curl_client_datashare_ops = { php_http_curl_client_datashare_detach, php_http_curl_client_datashare_setopt, (php_http_new_t) php_http_curl_client_datashare_object_new_ex, - get_class_entry + php_http_curl_client_datashare_get_class_entry }; PHP_HTTP_API php_http_client_datashare_ops_t *php_http_curl_client_datashare_get_ops(void) @@ -163,8 +158,14 @@ PHP_HTTP_API php_http_client_datashare_ops_t *php_http_curl_client_datashare_get #define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpClientDataShare, method, 0) #define PHP_HTTP_RSHARE_ME(method, visibility) PHP_ME(HttpClientDataShare, method, PHP_HTTP_ARGS(HttpClientDataShare, method), visibility) -zend_class_entry *php_http_curl_client_datashare_class_entry; -zend_function_entry php_http_curl_client_datashare_method_entry[] = { +static zend_class_entry *php_http_curl_client_datashare_class_entry; + +zend_class_entry *php_http_curl_client_datashare_get_class_entry(void) +{ + return php_http_curl_client_datashare_class_entry; +} + +static zend_function_entry php_http_curl_client_datashare_method_entry[] = { EMPTY_FUNCTION_ENTRY }; diff --git a/php_http_curl_client_datashare.h b/php_http_curl_client_datashare.h index d02796e..5d2a009 100644 --- a/php_http_curl_client_datashare.h +++ b/php_http_curl_client_datashare.h @@ -17,11 +17,10 @@ PHP_HTTP_API php_http_client_datashare_ops_t *php_http_curl_client_datashare_get_ops(void); -extern zend_class_entry *php_http_curl_client_datashare_class_entry; -extern zend_function_entry php_http_curl_client_datashare_method_entry[]; +zend_class_entry *php_http_curl_client_datashare_get_class_entry(void); -extern zend_object_value php_http_curl_client_datashare_object_new(zend_class_entry *ce TSRMLS_DC); -extern zend_object_value php_http_curl_client_datashare_object_new_ex(zend_class_entry *ce, php_http_client_datashare_t *share, php_http_client_datashare_object_t **ptr TSRMLS_DC); +zend_object_value php_http_curl_client_datashare_object_new(zend_class_entry *ce TSRMLS_DC); +zend_object_value php_http_curl_client_datashare_object_new_ex(zend_class_entry *ce, php_http_client_datashare_t *share, php_http_client_datashare_object_t **ptr TSRMLS_DC); PHP_MINIT_FUNCTION(http_curl_client_datashare); diff --git a/php_http_curl_client_pool.c b/php_http_curl_client_pool.c index 61a00f1..ea1bace 100644 --- a/php_http_curl_client_pool.c +++ b/php_http_curl_client_pool.c @@ -460,11 +460,6 @@ static php_http_resource_factory_ops_t php_http_curlm_resource_factory_ops = { php_http_curlm_dtor }; -static zend_class_entry *get_class_entry(void) -{ - return php_http_curl_client_pool_class_entry; -} - static php_http_client_pool_ops_t php_http_curl_client_pool_ops = { &php_http_curlm_resource_factory_ops, php_http_curl_client_pool_init, @@ -478,7 +473,7 @@ static php_http_client_pool_ops_t php_http_curl_client_pool_ops = { php_http_curl_client_pool_detach, php_http_curl_client_pool_setopt, (php_http_new_t) php_http_curl_client_pool_object_new_ex, - get_class_entry + php_http_curl_client_pool_get_class_entry }; PHP_HTTP_API php_http_client_pool_ops_t *php_http_curl_client_pool_get_ops(void) @@ -492,8 +487,14 @@ PHP_HTTP_API php_http_client_pool_ops_t *php_http_curl_client_pool_get_ops(void) #define PHP_HTTP_CURL_ALIAS(method, func) PHP_HTTP_STATIC_ME_ALIAS(method, func, PHP_HTTP_ARGS(HttpClientCURL, method)) #define PHP_HTTP_CURL_MALIAS(me, al, vis) ZEND_FENTRY(me, ZEND_MN(HttpClientCURL_##al), PHP_HTTP_ARGS(HttpClientCURL, al), vis) -zend_class_entry *php_http_curl_client_pool_class_entry; -zend_function_entry php_http_curl_client_pool_method_entry[] = { +static zend_class_entry *php_http_curl_client_pool_class_entry; + +zend_class_entry *php_http_curl_client_pool_get_class_entry(void) +{ + return php_http_curl_client_pool_class_entry; +} + +static zend_function_entry php_http_curl_client_pool_method_entry[] = { EMPTY_FUNCTION_ENTRY }; diff --git a/php_http_curl_client_pool.h b/php_http_curl_client_pool.h index c0e5eb9..69203fb 100644 --- a/php_http_curl_client_pool.h +++ b/php_http_curl_client_pool.h @@ -17,11 +17,10 @@ PHP_HTTP_API php_http_client_pool_ops_t *php_http_curl_client_pool_get_ops(void); -extern zend_class_entry *php_http_curl_client_pool_class_entry; -extern zend_function_entry php_http_curl_client_pool_method_entry[]; +zend_class_entry *php_http_curl_client_pool_get_class_entry(void); -extern zend_object_value php_http_curl_client_pool_object_new(zend_class_entry *ce TSRMLS_DC); -extern zend_object_value php_http_curl_client_pool_object_new_ex(zend_class_entry *ce, php_http_client_pool_t *p, php_http_client_pool_object_t **ptr TSRMLS_DC); +zend_object_value php_http_curl_client_pool_object_new(zend_class_entry *ce TSRMLS_DC); +zend_object_value php_http_curl_client_pool_object_new_ex(zend_class_entry *ce, php_http_client_pool_t *p, php_http_client_pool_object_t **ptr TSRMLS_DC); #if PHP_HTTP_HAVE_EVENT struct php_http_curl_globals { diff --git a/php_http_encoding.c b/php_http_encoding.c index bc3a1bd..4a71c80 100644 --- a/php_http_encoding.c +++ b/php_http_encoding.c @@ -929,8 +929,14 @@ PHP_HTTP_EMPTY_ARGS(flush); PHP_HTTP_EMPTY_ARGS(done); PHP_HTTP_EMPTY_ARGS(finish); -zend_class_entry *php_http_encoding_stream_class_entry; -zend_function_entry php_http_encoding_stream_method_entry[] = { +static zend_class_entry *php_http_encoding_stream_class_entry; + +zend_class_entry *php_http_encoding_stream_get_class_entry(void) +{ + return php_http_encoding_stream_class_entry; +} + +static zend_function_entry php_http_encoding_stream_method_entry[] = { PHP_HTTP_ENCSTREAM_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_HTTP_ENCSTREAM_ME(update, ZEND_ACC_PUBLIC) PHP_HTTP_ENCSTREAM_ME(flush, ZEND_ACC_PUBLIC) @@ -993,21 +999,21 @@ void php_http_encoding_stream_object_free(void *object TSRMLS_DC) PHP_METHOD(HttpEncodingStream, __construct) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { long flags = 0; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flags)) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { php_http_encoding_stream_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); if (!obj->stream) { php_http_encoding_stream_ops_t *ops = NULL; - if (instanceof_function(obj->zo.ce, php_http_deflate_stream_class_entry TSRMLS_CC)) { + if (instanceof_function(obj->zo.ce, php_http_deflate_stream_get_class_entry() TSRMLS_CC)) { ops = &php_http_encoding_deflate_ops; - } else if (instanceof_function(obj->zo.ce, php_http_inflate_stream_class_entry TSRMLS_CC)) { + } else if (instanceof_function(obj->zo.ce, php_http_inflate_stream_get_class_entry() TSRMLS_CC)) { ops = &php_http_encoding_inflate_ops; - } else if (instanceof_function(obj->zo.ce, php_http_dechunk_stream_class_entry TSRMLS_CC)) { + } else if (instanceof_function(obj->zo.ce, php_http_dechunk_stream_get_class_entry() TSRMLS_CC)) { ops = &php_http_encoding_dechunk_ops; } @@ -1110,8 +1116,14 @@ PHP_HTTP_BEGIN_ARGS(encode, 1) PHP_HTTP_ARG_VAL(flags, 0) PHP_HTTP_END_ARGS; -zend_class_entry *php_http_deflate_stream_class_entry; -zend_function_entry php_http_deflate_stream_method_entry[] = { +static zend_class_entry *php_http_deflate_stream_class_entry; + +zend_class_entry *php_http_deflate_stream_get_class_entry(void) +{ + return php_http_deflate_stream_class_entry; +} + +static zend_function_entry php_http_deflate_stream_method_entry[] = { PHP_HTTP_DEFLATE_ME(encode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) EMPTY_FUNCTION_ENTRY @@ -1144,8 +1156,14 @@ PHP_HTTP_BEGIN_ARGS(decode, 1) PHP_HTTP_ARG_VAL(data, 0) PHP_HTTP_END_ARGS; -zend_class_entry *php_http_inflate_stream_class_entry; -zend_function_entry php_http_inflate_stream_method_entry[] = { +static zend_class_entry *php_http_inflate_stream_class_entry; + +zend_class_entry *php_http_inflate_stream_get_class_entry(void) +{ + return php_http_inflate_stream_class_entry; +} + +static zend_function_entry php_http_inflate_stream_method_entry[] = { PHP_HTTP_INFLATE_ME(decode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) EMPTY_FUNCTION_ENTRY @@ -1178,8 +1196,14 @@ PHP_HTTP_BEGIN_ARGS(decode, 1) PHP_HTTP_ARG_VAL(decoded_len, 1) PHP_HTTP_END_ARGS; -zend_class_entry *php_http_dechunk_stream_class_entry; -zend_function_entry php_http_dechunk_stream_method_entry[] = { +static zend_class_entry *php_http_dechunk_stream_class_entry; + +zend_class_entry *php_http_dechunk_stream_get_class_entry(void) +{ + return php_http_dechunk_stream_class_entry; +} + +static zend_function_entry php_http_dechunk_stream_method_entry[] = { PHP_HTTP_DECHUNK_ME(decode, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) EMPTY_FUNCTION_ENTRY @@ -1209,7 +1233,7 @@ PHP_METHOD(HttpDechunkStream, decode) PHP_MINIT_FUNCTION(http_encoding) { - PHP_HTTP_REGISTER_CLASS(http\\Encoding, Stream, http_encoding_stream, php_http_object_class_entry, ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); + PHP_HTTP_REGISTER_CLASS(http\\Encoding, Stream, http_encoding_stream, php_http_object_get_class_entry(), ZEND_ACC_EXPLICIT_ABSTRACT_CLASS); php_http_encoding_stream_class_entry->create_object = php_http_encoding_stream_object_new; memcpy(&php_http_encoding_stream_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_http_encoding_stream_object_handlers.clone_obj = php_http_encoding_stream_object_clone; diff --git a/php_http_encoding.h b/php_http_encoding.h index 603880a..24d0146 100644 --- a/php_http_encoding.h +++ b/php_http_encoding.h @@ -148,9 +148,9 @@ struct php_http_encoding_stream { #endif }; -extern php_http_encoding_stream_ops_t *php_http_encoding_stream_get_deflate_ops(void); -extern php_http_encoding_stream_ops_t *php_http_encoding_stream_get_inflate_ops(void); -extern php_http_encoding_stream_ops_t *php_http_encoding_stream_get_dechunk_ops(void); +PHP_HTTP_API php_http_encoding_stream_ops_t *php_http_encoding_stream_get_deflate_ops(void); +PHP_HTTP_API php_http_encoding_stream_ops_t *php_http_encoding_stream_get_inflate_ops(void); +PHP_HTTP_API php_http_encoding_stream_ops_t *php_http_encoding_stream_get_dechunk_ops(void); PHP_HTTP_API php_http_encoding_stream_t *php_http_encoding_stream_init(php_http_encoding_stream_t *s, php_http_encoding_stream_ops_t *ops, unsigned flags TSRMLS_DC); PHP_HTTP_API php_http_encoding_stream_t *php_http_encoding_stream_copy(php_http_encoding_stream_t *from, php_http_encoding_stream_t *to); @@ -171,20 +171,16 @@ typedef struct php_http_encoding_stream_object { php_http_encoding_stream_t *stream; } php_http_encoding_stream_object_t; -extern zend_class_entry *php_http_encoding_stream_class_entry; -extern zend_function_entry php_http_encoding_stream_method_entry[]; +zend_class_entry *php_http_encoding_stream_get_class_entry(void); -extern zend_object_value php_http_encoding_stream_object_new(zend_class_entry *ce TSRMLS_DC); -extern zend_object_value php_http_encoding_stream_object_new_ex(zend_class_entry *ce, php_http_encoding_stream_t *s, php_http_encoding_stream_object_t **ptr TSRMLS_DC); -extern zend_object_value php_http_encoding_stream_object_clone(zval *object TSRMLS_DC); -extern void php_http_encoding_stream_object_free(void *object TSRMLS_DC); +zend_object_value php_http_encoding_stream_object_new(zend_class_entry *ce TSRMLS_DC); +zend_object_value php_http_encoding_stream_object_new_ex(zend_class_entry *ce, php_http_encoding_stream_t *s, php_http_encoding_stream_object_t **ptr TSRMLS_DC); +zend_object_value php_http_encoding_stream_object_clone(zval *object TSRMLS_DC); +void php_http_encoding_stream_object_free(void *object TSRMLS_DC); -extern zend_class_entry *php_http_deflate_stream_class_entry; -extern zend_function_entry php_http_deflate_stream_method_entry[]; -extern zend_class_entry *php_http_inflate_stream_class_entry; -extern zend_function_entry php_http_inflate_stream_method_entry[]; -extern zend_class_entry *php_http_dechunk_stream_class_entry; -extern zend_function_entry php_http_dechunk_stream_method_entry[]; +zend_class_entry *php_http_deflate_stream_get_class_entry(void); +zend_class_entry *php_http_inflate_stream_get_class_entry(void); +zend_class_entry *php_http_dechunk_stream_get_class_entry(void); PHP_METHOD(HttpEncodingStream, __construct); PHP_METHOD(HttpEncodingStream, update); diff --git a/php_http_env.c b/php_http_env.c index f1ebf1c..5df1e5b 100644 --- a/php_http_env.c +++ b/php_http_env.c @@ -604,7 +604,6 @@ PHP_HTTP_API const char *php_http_env_get_response_status_for_code(unsigned code return php_http_strlist_find(php_http_env_response_status, 100, code); } -zend_class_entry *php_http_env_class_entry; #define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpEnv, method, 0, req_args) #define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpEnv, method, 0) @@ -673,7 +672,14 @@ PHP_HTTP_BEGIN_ARGS(cleanPersistentHandles, 0) PHP_HTTP_ARG_VAL(ident, 0) PHP_HTTP_END_ARGS; -zend_function_entry php_http_env_method_entry[] = { +static zend_class_entry *php_http_env_class_entry; + +zend_class_entry *php_http_env_get_class_entry(void) +{ + return php_http_env_class_entry; +} + +static zend_function_entry php_http_env_method_entry[] = { PHP_HTTP_ENV_ME(getRequestHeader) PHP_HTTP_ENV_ME(getRequestBody) @@ -721,14 +727,14 @@ PHP_METHOD(HttpEnv, getRequestHeader) PHP_METHOD(HttpEnv, getRequestBody) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { - zend_class_entry *class_entry = php_http_message_body_class_entry; + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { + zend_class_entry *class_entry = php_http_message_body_get_class_entry(); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|C", &class_entry)) { zend_object_value ov; php_http_message_body_t *body = php_http_env_get_request_body(TSRMLS_C); - if (SUCCESS == php_http_new(&ov, class_entry, (php_http_new_t) php_http_message_body_object_new_ex, php_http_message_body_class_entry, php_http_message_body_copy(body, NULL, 0), NULL TSRMLS_CC)) { + if (SUCCESS == php_http_new(&ov, class_entry, (php_http_new_t) php_http_message_body_object_new_ex, php_http_message_body_get_class_entry(), php_http_message_body_copy(body, NULL, 0), NULL TSRMLS_CC)) { RETVAL_OBJVAL(ov, 0); } } diff --git a/php_http_env.h b/php_http_env.h index be0215b..4326054 100644 --- a/php_http_env.h +++ b/php_http_env.h @@ -70,8 +70,7 @@ PHP_HTTP_API zval *php_http_env_get_server_var(const char *key_str, size_t key_l #define php_http_env_got_server_var(v) (NULL != php_http_env_get_server_var((v), strlen(v), 1 TSRMLS_CC)) PHP_HTTP_API zval *php_http_env_get_superglobal(const char *key, size_t key_len TSRMLS_DC); -extern zend_class_entry *php_http_env_class_entry; -extern zend_function_entry php_http_env_method_entry[]; +zend_class_entry *php_http_env_get_class_entry(void); PHP_METHOD(HttpEnv, getRequestHeader); PHP_METHOD(HttpEnv, getRequestBody); diff --git a/php_http_env_request.c b/php_http_env_request.c index cd9dae0..3e88bd0 100644 --- a/php_http_env_request.c +++ b/php_http_env_request.c @@ -13,8 +13,6 @@ #include "php_http_api.h" -zend_class_entry *php_http_env_request_class_entry; - #undef PHP_HTTP_BEGIN_ARGS #undef PHP_HTTP_EMPTY_ARGS #define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpEnvRequest, method, 0, req_args) @@ -26,6 +24,13 @@ PHP_HTTP_EMPTY_ARGS(getForm); PHP_HTTP_EMPTY_ARGS(getQuery); PHP_HTTP_EMPTY_ARGS(getFiles); +static zend_class_entry *php_http_env_request_class_entry; + +zend_class_entry *php_http_env_request_get_class_entry(void) +{ + return php_http_env_request_class_entry; +} + zend_function_entry php_http_env_request_method_entry[] = { PHP_HTTP_ENV_REQUEST_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_HTTP_ENV_REQUEST_ME(getForm, ZEND_ACC_PUBLIC) @@ -119,7 +124,7 @@ static int grab_files(void *zpp TSRMLS_DC, int argc, va_list argv, zend_hash_key PHP_METHOD(HttpEnvRequest, __construct) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters_none()) { php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); zval *zsg; @@ -130,7 +135,7 @@ PHP_METHOD(HttpEnvRequest, __construct) zval *zquery; MAKE_STD_ZVAL(zquery); - object_init_ex(zquery, php_http_querystring_class_entry); + object_init_ex(zquery, php_http_querystring_get_class_entry()); if (SUCCESS == php_http_querystring_ctor(zquery, zsg TSRMLS_CC)) { zend_update_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("query"), zquery TSRMLS_CC); } @@ -140,7 +145,7 @@ PHP_METHOD(HttpEnvRequest, __construct) zval *zpost; MAKE_STD_ZVAL(zpost); - object_init_ex(zpost, php_http_querystring_class_entry); + object_init_ex(zpost, php_http_querystring_get_class_entry()); if (SUCCESS == php_http_querystring_ctor(zpost, zsg TSRMLS_CC)) { zend_update_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("form"), zpost TSRMLS_CC); } @@ -184,7 +189,7 @@ PHP_METHOD(HttpEnvRequest, getFiles) PHP_MINIT_FUNCTION(http_env_request) { - PHP_HTTP_REGISTER_CLASS(http\\Env, Request, http_env_request, php_http_message_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http\\Env, Request, http_env_request, php_http_message_get_class_entry(), 0); zend_declare_property_null(php_http_env_request_class_entry, ZEND_STRL("query"), ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_null(php_http_env_request_class_entry, ZEND_STRL("form"), ZEND_ACC_PROTECTED TSRMLS_CC); zend_declare_property_null(php_http_env_request_class_entry, ZEND_STRL("files"), ZEND_ACC_PROTECTED TSRMLS_CC); diff --git a/php_http_env_request.h b/php_http_env_request.h index cc59664..7b529a1 100644 --- a/php_http_env_request.h +++ b/php_http_env_request.h @@ -13,8 +13,7 @@ #ifndef PHP_HTTP_ENV_REQUEST_H #define PHP_HTTP_ENV_REQUEST_H -extern zend_class_entry *php_http_env_request_class_entry; -extern zend_function_entry php_http_env_request_method_entry[]; +zend_class_entry *php_http_env_request_get_class_entry(void); PHP_METHOD(HttpEnvRequest, __construct); PHP_METHOD(HttpEnvRequest, getForm); diff --git a/php_http_env_response.c b/php_http_env_response.c index 40b74ef..5f493a6 100644 --- a/php_http_env_response.c +++ b/php_http_env_response.c @@ -84,7 +84,7 @@ PHP_HTTP_API php_http_cache_status_t php_http_env_is_response_cached_by_etag(zva if ( !(zbody = get_option(options, ZEND_STRL("body") TSRMLS_CC)) || !(Z_TYPE_P(zbody) == IS_OBJECT) - || !instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_class_entry TSRMLS_CC) + || !instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_get_class_entry() TSRMLS_CC) ) { if (zbody) { zval_ptr_dtor(&zbody); @@ -133,7 +133,7 @@ PHP_HTTP_API php_http_cache_status_t php_http_env_is_response_cached_by_last_mod if ( !(zbody = get_option(options, ZEND_STRL("body") TSRMLS_CC)) || !(Z_TYPE_P(zbody) == IS_OBJECT) - || !instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_class_entry TSRMLS_CC) + || !instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_get_class_entry() TSRMLS_CC) ) { if (zbody) { zval_ptr_dtor(&zbody); @@ -517,7 +517,7 @@ static STATUS php_http_env_response_send_body(php_http_env_response_t *r) if ( (zbody = get_option(r->options, ZEND_STRL("body") TSRMLS_CC)) && (Z_TYPE_P(zbody) == IS_OBJECT) - && instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_class_entry TSRMLS_CC) + && instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_get_class_entry() TSRMLS_CC) ) { php_http_message_body_object_t *obj = zend_object_store_get_object(zbody TSRMLS_CC); @@ -594,7 +594,7 @@ PHP_HTTP_API STATUS php_http_env_response_send(php_http_env_response_t *r) /* check for ranges */ if ( (zbody = get_option(r->options, ZEND_STRL("body") TSRMLS_CC)) && (Z_TYPE_P(zbody) == IS_OBJECT) - && instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_class_entry TSRMLS_CC) + && instanceof_function(Z_OBJCE_P(zbody), php_http_message_body_get_class_entry() TSRMLS_CC) ) { php_http_message_body_object_t *obj = zend_object_store_get_object(zbody TSRMLS_CC); @@ -662,8 +662,6 @@ PHP_HTTP_API STATUS php_http_env_response_send(php_http_env_response_t *r) return SUCCESS; } -zend_class_entry *php_http_env_response_class_entry; - #undef PHP_HTTP_BEGIN_ARGS #undef PHP_HTTP_EMPTY_ARGS #define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpEnvResponse, method, 0, req_args) @@ -716,8 +714,14 @@ PHP_HTTP_END_ARGS; PHP_HTTP_EMPTY_ARGS(send); +static zend_class_entry *php_http_env_response_class_entry; + +zend_class_entry *php_http_env_response_get_class_entry(void) +{ + return php_http_env_response_class_entry; +} -zend_function_entry php_http_env_response_method_entry[] = { +static zend_function_entry php_http_env_response_method_entry[] = { PHP_HTTP_ENV_RESPONSE_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_HTTP_ENV_RESPONSE_ME(__invoke, ZEND_ACC_PUBLIC) PHP_HTTP_ENV_RESPONSE_ME(setContentType, ZEND_ACC_PUBLIC) @@ -738,11 +742,11 @@ zend_function_entry php_http_env_response_method_entry[] = { PHP_METHOD(HttpEnvResponse, __construct) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters_none()) { php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { obj->message = php_http_message_init_env(obj->message, PHP_HTTP_RESPONSE TSRMLS_CC); } end_error_handling(); } @@ -759,7 +763,7 @@ PHP_METHOD(HttpEnvResponse, __invoke) if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &ob_str, &ob_len, &ob_flags)) { php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); - if (obj->body.handle || SUCCESS == php_http_new(&obj->body, php_http_message_body_class_entry, (php_http_new_t) php_http_message_body_object_new_ex, NULL, (void *) php_http_message_body_copy(&obj->message->body, NULL, 0), NULL TSRMLS_CC)) { + if (obj->body.handle || SUCCESS == php_http_new(&obj->body, php_http_message_body_get_class_entry(), (php_http_new_t) php_http_message_body_object_new_ex, NULL, (void *) php_http_message_body_copy(&obj->message->body, NULL, 0), NULL TSRMLS_CC)) { php_http_message_body_append(&obj->message->body, ob_str, ob_len); RETURN_TRUE; } @@ -886,7 +890,7 @@ PHP_METHOD(HttpEnvResponse, send) PHP_MINIT_FUNCTION(http_env_response) { - PHP_HTTP_REGISTER_CLASS(http\\Env, Response, http_env_response, php_http_message_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http\\Env, Response, http_env_response, php_http_message_get_class_entry(), 0); zend_declare_class_constant_long(php_http_env_response_class_entry, ZEND_STRL("CONTENT_ENCODING_NONE"), PHP_HTTP_CONTENT_ENCODING_NONE TSRMLS_CC); zend_declare_class_constant_long(php_http_env_response_class_entry, ZEND_STRL("CONTENT_ENCODING_GZIP"), PHP_HTTP_CONTENT_ENCODING_GZIP TSRMLS_CC); diff --git a/php_http_env_response.h b/php_http_env_response.h index ab5ee5c..1031daa 100644 --- a/php_http_env_response.h +++ b/php_http_env_response.h @@ -51,8 +51,7 @@ PHP_HTTP_API void php_http_env_response_free(php_http_env_response_t **r); PHP_HTTP_API php_http_cache_status_t php_http_env_is_response_cached_by_etag(zval *options, const char *header_str, size_t header_len TSRMLS_DC); PHP_HTTP_API php_http_cache_status_t php_http_env_is_response_cached_by_last_modified(zval *options, const char *header_str, size_t header_len TSRMLS_DC); -extern zend_class_entry *php_http_env_response_class_entry; -extern zend_function_entry php_http_env_response_method_entry[]; +zend_class_entry *php_http_env_response_get_class_entry(void); PHP_METHOD(HttpEnvResponse, __construct); PHP_METHOD(HttpEnvResponse, __invoke); diff --git a/php_http_exception.c b/php_http_exception.c index cd5dcfe..2c6dc1f 100644 --- a/php_http_exception.c +++ b/php_http_exception.c @@ -18,11 +18,12 @@ # define PHP_HTTP_DBG_EXCEPTIONS 0 #endif -zend_class_entry *php_http_exception_class_entry; +static zend_class_entry *php_http_exception_class_entry; -zend_function_entry php_http_exception_method_entry[] = { - EMPTY_FUNCTION_ENTRY -}; +zend_class_entry *php_http_exception_get_class_entry(void) +{ + return php_http_exception_class_entry; +} #if PHP_HTTP_DBG_EXCEPTIONS static void php_http_exception_hook(zval *ex TSRMLS_DC) @@ -40,23 +41,23 @@ PHP_MINIT_FUNCTION(http_exception) { PHP_HTTP_REGISTER_EXCEPTION(Exception, php_http_exception_class_entry, zend_exception_get_default(TSRMLS_C)); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_UNKNOWN"), PHP_HTTP_E_UNKNOWN TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_RUNTIME"), PHP_HTTP_E_RUNTIME TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_INVALID_PARAM"), PHP_HTTP_E_INVALID_PARAM TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_HEADER"), PHP_HTTP_E_HEADER TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_MALFORMED_HEADERS"), PHP_HTTP_E_MALFORMED_HEADERS TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_MESSAGE"), PHP_HTTP_E_MESSAGE TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_MESSAGE_TYPE"), PHP_HTTP_E_MESSAGE_TYPE TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_MESSAGE_BODY"), PHP_HTTP_E_MESSAGE_BODY TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_ENCODING"), PHP_HTTP_E_ENCODING TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_CLIENT"), PHP_HTTP_E_CLIENT TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_CLIENT_POOL"), PHP_HTTP_E_CLIENT_POOL TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_CLIENT_DATASHARE"), PHP_HTTP_E_CLIENT_DATASHARE TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_SOCKET"), PHP_HTTP_E_SOCKET TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_RESPONSE"), PHP_HTTP_E_RESPONSE TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_URL"), PHP_HTTP_E_URL TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_QUERYSTRING"), PHP_HTTP_E_QUERYSTRING TSRMLS_CC); - zend_declare_class_constant_long(php_http_exception_class_entry, ZEND_STRL("E_COOKIE"), PHP_HTTP_E_COOKIE TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_UNKNOWN"), PHP_HTTP_E_UNKNOWN TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_RUNTIME"), PHP_HTTP_E_RUNTIME TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_INVALID_PARAM"), PHP_HTTP_E_INVALID_PARAM TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_HEADER"), PHP_HTTP_E_HEADER TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_MALFORMED_HEADERS"), PHP_HTTP_E_MALFORMED_HEADERS TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_MESSAGE"), PHP_HTTP_E_MESSAGE TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_MESSAGE_TYPE"), PHP_HTTP_E_MESSAGE_TYPE TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_MESSAGE_BODY"), PHP_HTTP_E_MESSAGE_BODY TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_ENCODING"), PHP_HTTP_E_ENCODING TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_CLIENT"), PHP_HTTP_E_CLIENT TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_CLIENT_POOL"), PHP_HTTP_E_CLIENT_POOL TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_CLIENT_DATASHARE"), PHP_HTTP_E_CLIENT_DATASHARE TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_SOCKET"), PHP_HTTP_E_SOCKET TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_RESPONSE"), PHP_HTTP_E_RESPONSE TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_URL"), PHP_HTTP_E_URL TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_QUERYSTRING"), PHP_HTTP_E_QUERYSTRING TSRMLS_CC); + zend_declare_class_constant_long(php_http_exception_get_class_entry(), ZEND_STRL("E_COOKIE"), PHP_HTTP_E_COOKIE TSRMLS_CC); #if PHP_HTTP_DBG_EXCEPTIONS zend_throw_exception_hook = php_http_exception_hook; diff --git a/php_http_exception.h b/php_http_exception.h index ccc3aaa..f48f9b4 100644 --- a/php_http_exception.h +++ b/php_http_exception.h @@ -13,10 +13,7 @@ #ifndef PHP_HTTP_EXCEPTION_H #define PHP_HTTP_EXCEPTION_H -PHP_MINIT_FUNCTION(http_exception_object); - -extern zend_class_entry *php_http_exception_class_entry; -extern zend_function_entry php_http_exception_method_entry[]; +zend_class_entry *php_http_exception_get_class_entry(void); PHP_MINIT_FUNCTION(http_exception); diff --git a/php_http_filter.c b/php_http_filter.c index 2c53358..ae42627 100644 --- a/php_http_filter.c +++ b/php_http_filter.c @@ -423,7 +423,7 @@ static php_stream_filter *http_filter_create(const char *name, zval *params, int return f; } -php_stream_filter_factory php_http_filter_factory = { +PHP_HTTP_API php_stream_filter_factory php_http_filter_factory = { http_filter_create }; diff --git a/php_http_filter.h b/php_http_filter.h index 4ba7ad3..4b4806d 100644 --- a/php_http_filter.h +++ b/php_http_filter.h @@ -13,7 +13,7 @@ #ifndef PHP_HTTP_FILTER_H #define PHP_HTTP_FILTER_H -extern php_stream_filter_factory php_http_filter_factory; +PHP_HTTP_API php_stream_filter_factory php_http_filter_factory; PHP_MINIT_FUNCTION(http_filter); #endif diff --git a/php_http_fluently_callable.c b/php_http_fluently_callable.c deleted file mode 100644 index 2f674b8..0000000 --- a/php_http_fluently_callable.c +++ /dev/null @@ -1,13 +0,0 @@ - -#include "php_http.h" - -zend_class_entry *php_http_fluently_callable_class_entry; -zend_function_entry php_http_fluently_callable_method_entry[] = { - EMPTY_FUNCTION_ENTRY -}; - -PHP_MINIT_FUNCTION(http_fluently_callable) -{ - PHP_HTTP_REGISTER_INTERFACE(http, FluentlyCallable, http_fluently_callable, 0); - return SUCCESS; -} diff --git a/php_http_fluently_callable.h b/php_http_fluently_callable.h deleted file mode 100644 index 9b4650f..0000000 --- a/php_http_fluently_callable.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef PHP_HTTP_FLUENTLY_CALLABLE_H -#define PHP_HTTP_FLUENTLY_CALLABLE_H - -extern zend_class_entry *php_http_fluently_callable_class_entry; -extern zend_function_entry php_http_fluently_callable_method_entry[]; - -extern PHP_MINIT_FUNCTION(http_fluently_callable); - -#endif /* PHP_HTTP_FLUENTLY_CALLABLE_H */ diff --git a/php_http_headers.c b/php_http_headers.c index 226c763..51a6997 100644 --- a/php_http_headers.c +++ b/php_http_headers.c @@ -26,8 +26,6 @@ PHP_HTTP_API STATUS php_http_headers_parse(const char *header, size_t length, Ha return SUCCESS; } -zend_class_entry *php_http_header_class_entry; - #define PHP_HTTP_BEGIN_ARGS(method, req_args) PHP_HTTP_BEGIN_ARGS_EX(HttpHeader, method, 0, req_args) #define PHP_HTTP_EMPTY_ARGS(method) PHP_HTTP_EMPTY_ARGS_EX(HttpHeader, method, 0) #define PHP_HTTP_HEADER_ME(method, v) PHP_ME(HttpHeader, method, PHP_HTTP_ARGS(HttpHeader, method), v) @@ -37,7 +35,7 @@ PHP_HTTP_BEGIN_ARGS(__construct, 0) PHP_HTTP_ARG_VAL(value, 0) PHP_HTTP_END_ARGS; -PHP_HTTP_EMPTY_ARGS(toString); +PHP_HTTP_EMPTY_ARGS(serialize); PHP_HTTP_BEGIN_ARGS(unserialize, 1) PHP_HTTP_ARG_VAL(serialized, 0) PHP_HTTP_END_ARGS; @@ -47,11 +45,18 @@ PHP_HTTP_BEGIN_ARGS(match, 1) PHP_HTTP_ARG_VAL(flags, 0) PHP_HTTP_END_ARGS; -zend_function_entry php_http_header_method_entry[] = { +static zend_class_entry *php_http_header_class_entry; + +zend_class_entry *php_http_header_get_class_entry(void) +{ + return php_http_header_class_entry; +} + +static zend_function_entry php_http_header_method_entry[] = { PHP_HTTP_HEADER_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) - PHP_HTTP_HEADER_ME(toString, ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpHeader, __toString, toString, PHP_HTTP_ARGS(HttpHeader, toString), ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpHeader, serialize, toString, PHP_HTTP_ARGS(HttpHeader, toString), ZEND_ACC_PUBLIC) + PHP_HTTP_HEADER_ME(serialize, ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpHeader, __toString, serialize, PHP_HTTP_ARGS(HttpHeader, serialize), ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpHeader, toString, serialize, PHP_HTTP_ARGS(HttpHeader, serialize), ZEND_ACC_PUBLIC) PHP_HTTP_HEADER_ME(unserialize, ZEND_ACC_PUBLIC) PHP_HTTP_HEADER_ME(match, ZEND_ACC_PUBLIC) EMPTY_FUNCTION_ENTRY @@ -62,7 +67,7 @@ PHP_METHOD(HttpHeader, __construct) char *name_str = NULL, *value_str = NULL; int name_len = 0, value_len = 0; - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!", &name_str, &name_len, &value_str, &value_len)) { if (name_str && name_len) { char *pretty_str = estrndup(name_str, name_len); @@ -76,7 +81,7 @@ PHP_METHOD(HttpHeader, __construct) } end_error_handling(); } -PHP_METHOD(HttpHeader, toString) +PHP_METHOD(HttpHeader, serialize) { php_http_buffer_t buf; zval *zname, *zvalue; @@ -153,7 +158,7 @@ PHP_METHOD(HttpHeader, match) PHP_MINIT_FUNCTION(http_header) { - PHP_HTTP_REGISTER_CLASS(http, Header, http_header, php_http_object_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http, Header, http_header, php_http_object_get_class_entry(), 0); zend_class_implements(php_http_header_class_entry TSRMLS_CC, 1, zend_ce_serializable); zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_LOOSE"), PHP_HTTP_MATCH_LOOSE TSRMLS_CC); zend_declare_class_constant_long(php_http_header_class_entry, ZEND_STRL("MATCH_CASE"), PHP_HTTP_MATCH_CASE TSRMLS_CC); @@ -165,6 +170,7 @@ PHP_MINIT_FUNCTION(http_header) return SUCCESS; } + /* * Local variables: * tab-width: 4 diff --git a/php_http_headers.h b/php_http_headers.h index bb6b19f..0d67f12 100644 --- a/php_http_headers.h +++ b/php_http_headers.h @@ -17,11 +17,10 @@ PHP_HTTP_API STATUS php_http_headers_parse(const char *header, size_t length, HashTable *headers, php_http_info_callback_t callback_func, void **callback_data TSRMLS_DC); -extern zend_class_entry *php_http_header_class_entry; -extern zend_function_entry php_http_header_method_entry[]; +zend_class_entry *php_http_header_get_class_entry(void); PHP_METHOD(HttpHeader, __construct); -PHP_METHOD(HttpHeader, toString); +PHP_METHOD(HttpHeader, serialize); PHP_METHOD(HttpHeader, unserialize); PHP_METHOD(HttpHeader, match); diff --git a/php_http_message.c b/php_http_message.c index 42ebe42..f8b3a4d 100644 --- a/php_http_message.c +++ b/php_http_message.c @@ -643,8 +643,14 @@ static void php_http_message_object_write_prop(zval *object, zval *member, zval static zval **php_http_message_object_get_prop_ptr(zval *object, zval *member, const zend_literal *literal_key TSRMLS_DC); static HashTable *php_http_message_object_get_props(zval *object TSRMLS_DC); -zend_class_entry *php_http_message_class_entry; -zend_function_entry php_http_message_method_entry[] = { +static zend_class_entry *php_http_message_class_entry; + +zend_class_entry *php_http_message_get_class_entry(void) +{ + return php_http_message_class_entry; +} + +static zend_function_entry php_http_message_method_entry[] = { PHP_HTTP_MESSAGE_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_HTTP_MESSAGE_ME(getBody, ZEND_ACC_PUBLIC) PHP_HTTP_MESSAGE_ME(setBody, ZEND_ACC_PUBLIC) @@ -817,7 +823,7 @@ static void php_http_message_object_prophandler_get_body(php_http_message_object } } static void php_http_message_object_prophandler_set_body(php_http_message_object_t *obj, zval *value TSRMLS_DC) { - if (Z_TYPE_P(value) == IS_OBJECT && instanceof_function(Z_OBJCE_P(value), php_http_message_body_class_entry TSRMLS_CC)) { + if (Z_TYPE_P(value) == IS_OBJECT && instanceof_function(Z_OBJCE_P(value), php_http_message_body_get_class_entry() TSRMLS_CC)) { if (obj->body.handle) { zend_objects_store_del_ref_by_handle(obj->body.handle TSRMLS_CC); } @@ -844,7 +850,7 @@ static void php_http_message_object_prophandler_set_parent_message(php_http_mess PHP_MINIT_FUNCTION(http_message) { - PHP_HTTP_REGISTER_CLASS(http, Message, http_message, php_http_object_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http, Message, http_message, php_http_object_get_class_entry(), 0); php_http_message_class_entry->create_object = php_http_message_object_new; memcpy(&php_http_message_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_http_message_object_handlers.clone_obj = php_http_message_object_clone; @@ -999,7 +1005,7 @@ zend_object_value php_http_message_object_new_ex(zend_class_entry *ce, php_http_ if (msg->parent) { o->parent = php_http_message_object_new_ex(ce, msg->parent, NULL TSRMLS_CC); } - o->body = php_http_message_body_object_new_ex(php_http_message_body_class_entry, php_http_message_body_copy(&msg->body, NULL, 0), NULL TSRMLS_CC); + o->body = php_http_message_body_object_new_ex(php_http_message_body_get_class_entry(), php_http_message_body_copy(&msg->body, NULL, 0), NULL TSRMLS_CC); } ov.handle = zend_objects_store_put((zend_object *) o, NULL, php_http_message_object_free, NULL TSRMLS_CC); @@ -1165,7 +1171,7 @@ static HashTable *php_http_message_object_get_props(zval *object TSRMLS_DC) MAKE_STD_ZVAL(body); if (!obj->body.handle) { - php_http_new(&obj->body, php_http_message_body_class_entry, (php_http_new_t) php_http_message_body_object_new_ex, NULL, (void *) php_http_message_body_copy(&obj->message->body, NULL, 0), NULL TSRMLS_CC); + php_http_new(&obj->body, php_http_message_body_get_class_entry(), (php_http_new_t) php_http_message_body_object_new_ex, NULL, (void *) php_http_message_body_copy(&obj->message->body, NULL, 0), NULL TSRMLS_CC); } ZVAL_OBJVAL(body, obj->body, 1); ASSOC_PROP(array, zval, "body", body); @@ -1189,7 +1195,7 @@ PHP_METHOD(HttpMessage, __construct) php_http_message_t *msg = NULL; php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!", &zmessage) && zmessage) { if (Z_TYPE_P(zmessage) == IS_RESOURCE) { php_stream *s; @@ -1225,7 +1231,7 @@ PHP_METHOD(HttpMessage, __construct) PHP_METHOD(HttpMessage, getBody) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters_none()) { php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); @@ -1233,7 +1239,7 @@ PHP_METHOD(HttpMessage, getBody) obj->message = php_http_message_init(NULL, 0 TSRMLS_CC); } - if (obj->body.handle || SUCCESS == php_http_new(&obj->body, php_http_message_body_class_entry, (php_http_new_t) php_http_message_body_object_new_ex, NULL, (void *) php_http_message_body_copy(&obj->message->body, NULL, 0), NULL TSRMLS_CC)) { + if (obj->body.handle || SUCCESS == php_http_new(&obj->body, php_http_message_body_get_class_entry(), (php_http_new_t) php_http_message_body_object_new_ex, NULL, (void *) php_http_message_body_copy(&obj->message->body, NULL, 0), NULL TSRMLS_CC)) { RETVAL_OBJVAL(obj->body, 1); } } @@ -1244,7 +1250,7 @@ PHP_METHOD(HttpMessage, setBody) { zval *zbody; - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zbody, php_http_message_body_class_entry)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zbody, php_http_message_body_get_class_entry())) { php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); php_http_message_body_object_t *body_obj = zend_object_store_get_object(zbody TSRMLS_CC); @@ -1264,7 +1270,7 @@ PHP_METHOD(HttpMessage, addBody) { zval *new_body; - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &new_body, php_http_message_body_class_entry)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &new_body, php_http_message_body_get_class_entry())) { php_http_message_body_object_t *old_obj = zend_object_store_get_object(getThis() TSRMLS_CC); php_http_message_body_object_t *new_obj = zend_object_store_get_object(new_body TSRMLS_CC); @@ -1674,7 +1680,7 @@ PHP_METHOD(HttpMessage, setRequestUrl) PHP_METHOD(HttpMessage, getParentMessage) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters_none()) { php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); @@ -1795,7 +1801,7 @@ PHP_METHOD(HttpMessage, unserialize) PHP_METHOD(HttpMessage, detach) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters_none()) { php_http_message_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); diff --git a/php_http_message.h b/php_http_message.h index c78101d..cd2615e 100644 --- a/php_http_message.h +++ b/php_http_message.h @@ -77,19 +77,18 @@ typedef struct php_http_message_object { zval *iterator; } php_http_message_object_t; -extern zend_class_entry *php_http_message_class_entry; -extern zend_function_entry http_message_method_entry[]; +zend_class_entry *php_http_message_get_class_entry(void); -extern PHP_MINIT_FUNCTION(http_message); -extern PHP_MSHUTDOWN_FUNCTION(http_message); +PHP_MINIT_FUNCTION(http_message); +PHP_MSHUTDOWN_FUNCTION(http_message); -extern void php_http_message_object_prepend(zval *this_ptr, zval *prepend, zend_bool top /* = 1 */ TSRMLS_DC); -extern void php_http_message_object_reverse(zval *this_ptr, zval *return_value TSRMLS_DC); +void php_http_message_object_prepend(zval *this_ptr, zval *prepend, zend_bool top /* = 1 */ TSRMLS_DC); +void php_http_message_object_reverse(zval *this_ptr, zval *return_value TSRMLS_DC); -extern zend_object_value php_http_message_object_new(zend_class_entry *ce TSRMLS_DC); -extern zend_object_value php_http_message_object_new_ex(zend_class_entry *ce, php_http_message_t *msg, php_http_message_object_t **ptr TSRMLS_DC); -extern zend_object_value php_http_message_object_clone(zval *object TSRMLS_DC); -extern void php_http_message_object_free(void *object TSRMLS_DC); +zend_object_value php_http_message_object_new(zend_class_entry *ce TSRMLS_DC); +zend_object_value php_http_message_object_new_ex(zend_class_entry *ce, php_http_message_t *msg, php_http_message_object_t **ptr TSRMLS_DC); +zend_object_value php_http_message_object_clone(zval *object TSRMLS_DC); +void php_http_message_object_free(void *object TSRMLS_DC); PHP_METHOD(HttpMessage, __construct); PHP_METHOD(HttpMessage, getBody); diff --git a/php_http_message_body.c b/php_http_message_body.c index 5bcc958..c4c3f9d 100644 --- a/php_http_message_body.c +++ b/php_http_message_body.c @@ -562,8 +562,14 @@ PHP_HTTP_BEGIN_ARGS(stat, 0) PHP_HTTP_ARG_VAL(what, 0) PHP_HTTP_END_ARGS; -zend_class_entry *php_http_message_body_class_entry; -zend_function_entry php_http_message_body_method_entry[] = { +static zend_class_entry *php_http_message_body_class_entry; + +zend_class_entry *php_http_message_body_get_class_entry(void) +{ + return php_http_message_body_class_entry; +} + +static zend_function_entry php_http_message_body_method_entry[] = { PHP_HTTP_MESSAGE_BODY_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_HTTP_MESSAGE_BODY_ME(__toString, ZEND_ACC_PUBLIC) PHP_MALIAS(HttpMessageBody, toString, __toString, args_for_HttpMessageBody___toString, ZEND_ACC_PUBLIC) @@ -580,7 +586,7 @@ static zend_object_handlers php_http_message_body_object_handlers; PHP_MINIT_FUNCTION(http_message_body) { - PHP_HTTP_REGISTER_CLASS(http\\Message, Body, http_message_body, php_http_object_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http\\Message, Body, http_message_body, php_http_object_get_class_entry(), 0); php_http_message_body_class_entry->create_object = php_http_message_body_object_new; memcpy(&php_http_message_body_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_http_message_body_object_handlers.clone_obj = php_http_message_body_object_clone; @@ -644,7 +650,7 @@ PHP_METHOD(HttpMessageBody, __construct) zval *zstream = NULL; php_stream *stream; - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r!", &zstream)) { if (zstream) { php_stream_from_zval(stream, &zstream); @@ -745,7 +751,7 @@ PHP_METHOD(HttpMessageBody, addPart) { zval *zobj; - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zobj, php_http_message_class_entry)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &zobj, php_http_message_get_class_entry())) { php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC); php_http_message_object_t *mobj = zend_object_store_get_object(zobj TSRMLS_CC); diff --git a/php_http_message_body.h b/php_http_message_body.h index 61fdb75..4e3fae9 100644 --- a/php_http_message_body.h +++ b/php_http_message_body.h @@ -56,15 +56,14 @@ typedef struct php_http_message_body_object { php_http_message_body_t *body; } php_http_message_body_object_t; -extern zend_class_entry *php_http_message_body_class_entry; -extern zend_function_entry php_http_message_body_method_entry[]; +zend_class_entry *php_http_message_body_get_class_entry(void); -extern PHP_MINIT_FUNCTION(http_message_body); +PHP_MINIT_FUNCTION(http_message_body); -extern zend_object_value php_http_message_body_object_new(zend_class_entry *ce TSRMLS_DC); -extern zend_object_value php_http_message_body_object_new_ex(zend_class_entry *ce, php_http_message_body_t *body, php_http_message_body_object_t **ptr TSRMLS_DC); -extern zend_object_value php_http_message_body_object_clone(zval *object TSRMLS_DC); -extern void php_http_message_body_object_free(void *object TSRMLS_DC); +zend_object_value php_http_message_body_object_new(zend_class_entry *ce TSRMLS_DC); +zend_object_value php_http_message_body_object_new_ex(zend_class_entry *ce, php_http_message_body_t *body, php_http_message_body_object_t **ptr TSRMLS_DC); +zend_object_value php_http_message_body_object_clone(zval *object TSRMLS_DC); +void php_http_message_body_object_free(void *object TSRMLS_DC); PHP_METHOD(HttpMessageBody, __construct); PHP_METHOD(HttpMessageBody, __toString); diff --git a/php_http_misc.c b/php_http_misc.c index c4661b7..bb99062 100644 --- a/php_http_misc.c +++ b/php_http_misc.c @@ -236,7 +236,7 @@ static inline int scope_error_handling(long type TSRMLS_DC) return EH_THROW; } - if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), php_http_object_class_entry TSRMLS_CC)) { + if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), php_http_object_get_class_entry() TSRMLS_CC)) { return php_http_object_get_error_handling(EG(This) TSRMLS_CC); } @@ -251,9 +251,10 @@ void php_http_error(long type TSRMLS_DC, long code, const char *format, ...) switch (scope_error_handling(type TSRMLS_CC)) { case EH_THROW: { char *message; - zend_class_entry *ce = php_http_exception_class_entry; + zend_class_entry *ce = php_http_exception_get_class_entry(); - if (0&& EG(exception_class) && instanceof_function(EG(exception_class), php_http_exception_class_entry TSRMLS_CC)) { + /* FIXME wat? */ + if (0&& EG(exception_class) && instanceof_function(EG(exception_class), ce TSRMLS_CC)) { ce = EG(exception_class); } diff --git a/php_http_misc.h b/php_http_misc.h index 33be199..16a7be8 100644 --- a/php_http_misc.h +++ b/php_http_misc.h @@ -79,10 +79,10 @@ PHP_HTTP_API void php_http_sleep(double s); #define PHP_HTTP_MATCH_FULL 0x20 #define PHP_HTTP_MATCH_STRICT (PHP_HTTP_MATCH_CASE|PHP_HTTP_MATCH_FULL) -extern int php_http_match(const char *haystack, const char *needle, int flags); -extern char *php_http_pretty_key(char *key, size_t key_len, zend_bool uctitle, zend_bool xhyphen); -extern size_t php_http_boundary(char *buf, size_t len TSRMLS_DC); -extern int php_http_select_str(const char *cmp, int argc, ...); +int php_http_match(const char *haystack, const char *needle, int flags); +char *php_http_pretty_key(char *key, size_t key_len, zend_bool uctitle, zend_bool xhyphen); +size_t php_http_boundary(char *buf, size_t len TSRMLS_DC); +int php_http_select_str(const char *cmp, int argc, ...); static inline const char *php_http_locate_str(const char *h, size_t h_len, const char *n, size_t n_len) { @@ -403,8 +403,8 @@ typedef struct php_http_array_hashkey { #define ARRAY_JOIN_PRETTIFY 2 #define array_join(src, dst, append, flags) zend_hash_apply_with_arguments(src TSRMLS_CC, (append)?php_http_array_apply_append_func:php_http_array_apply_merge_func, 2, dst, (int)flags) -extern int php_http_array_apply_append_func(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key); -extern int php_http_array_apply_merge_func(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key); +int php_http_array_apply_append_func(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key); +int php_http_array_apply_merge_func(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key); /* PASS CALLBACK */ diff --git a/php_http_object.c b/php_http_object.c index 602ebaa..c278e6b 100644 --- a/php_http_object.c +++ b/php_http_object.c @@ -12,7 +12,7 @@ #include "php_http_api.h" -STATUS php_http_new(zend_object_value *ov, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC) +PHP_HTTP_API STATUS php_http_new(zend_object_value *ov, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC) { if (!ce) { ce = parent_ce; @@ -37,7 +37,7 @@ PHP_HTTP_API zend_error_handling_t php_http_object_get_error_handling(zval *obje zval_ptr_dtor(&lzeh); return eh; } - zeh = zend_read_static_property(php_http_object_class_entry, ZEND_STRL("defaultErrorHandling"), 0 TSRMLS_CC); + zeh = zend_read_static_property(php_http_object_get_class_entry(), ZEND_STRL("defaultErrorHandling"), 0 TSRMLS_CC); if (Z_TYPE_P(zeh) != IS_NULL) { lzeh = php_http_ztyp(IS_LONG, zeh); eh = Z_LVAL_P(lzeh); @@ -69,8 +69,14 @@ PHP_HTTP_BEGIN_ARGS(triggerError, 3) PHP_HTTP_ARG_VAL(error_message, 0) PHP_HTTP_END_ARGS; -zend_class_entry *php_http_object_class_entry; -zend_function_entry php_http_object_method_entry[] = { +static zend_class_entry *php_http_object_class_entry; + +zend_class_entry *php_http_object_get_class_entry(void) +{ + return php_http_object_class_entry; +} + +static zend_function_entry php_http_object_method_entry[] = { PHP_HTTP_OBJECT_ME(setErrorHandling, ZEND_ACC_PUBLIC) PHP_HTTP_OBJECT_ME(getErrorHandling, ZEND_ACC_PUBLIC) PHP_HTTP_OBJECT_ME(setDefaultErrorHandling, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) @@ -106,7 +112,7 @@ zend_object_value php_http_object_new_ex(zend_class_entry *ce, void *nothing, ph PHP_METHOD(HttpObject, getErrorHandling) { - RETURN_PROP(php_http_object_class_entry, "errorHandling"); + RETURN_PROP(php_http_object_get_class_entry(), "errorHandling"); } PHP_METHOD(HttpObject, setErrorHandling) @@ -118,7 +124,7 @@ PHP_METHOD(HttpObject, setErrorHandling) case EH_NORMAL: case EH_SUPPRESS: case EH_THROW: - zend_update_property_long(php_http_object_class_entry, getThis(), ZEND_STRL("errorHandling"), eh TSRMLS_CC); + zend_update_property_long(php_http_object_get_class_entry(), getThis(), ZEND_STRL("errorHandling"), eh TSRMLS_CC); break; default: @@ -132,7 +138,7 @@ PHP_METHOD(HttpObject, setErrorHandling) PHP_METHOD(HttpObject, getDefaultErrorHandling) { - RETURN_SPROP(php_http_object_class_entry, "defaultErrorHandling"); + RETURN_SPROP(php_http_object_get_class_entry(), "defaultErrorHandling"); } PHP_METHOD(HttpObject, setDefaultErrorHandling) @@ -144,7 +150,7 @@ PHP_METHOD(HttpObject, setDefaultErrorHandling) case EH_NORMAL: case EH_SUPPRESS: case EH_THROW: - zend_update_static_property_long(php_http_object_class_entry, ZEND_STRL("defaultErrorHandling"), eh TSRMLS_CC); + zend_update_static_property_long(php_http_object_get_class_entry(), ZEND_STRL("defaultErrorHandling"), eh TSRMLS_CC); break; default: @@ -168,14 +174,14 @@ PHP_METHOD(HttpObject, triggerError) PHP_MINIT_FUNCTION(http_object) { PHP_HTTP_REGISTER_CLASS(http, Object, http_object, NULL, ZEND_ACC_ABSTRACT); - php_http_object_class_entry->create_object = php_http_object_new; + php_http_object_get_class_entry()->create_object = php_http_object_new; - zend_declare_property_null(php_http_object_class_entry, ZEND_STRL("defaultErrorHandling"), (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC); - zend_declare_property_null(php_http_object_class_entry, ZEND_STRL("errorHandling"), ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_null(php_http_object_get_class_entry(), ZEND_STRL("defaultErrorHandling"), (ZEND_ACC_STATIC|ZEND_ACC_PROTECTED) TSRMLS_CC); + zend_declare_property_null(php_http_object_get_class_entry(), ZEND_STRL("errorHandling"), ZEND_ACC_PROTECTED TSRMLS_CC); - zend_declare_class_constant_long(php_http_object_class_entry, ZEND_STRL("EH_NORMAL"), EH_NORMAL TSRMLS_CC); - zend_declare_class_constant_long(php_http_object_class_entry, ZEND_STRL("EH_SUPPRESS"), EH_SUPPRESS TSRMLS_CC); - zend_declare_class_constant_long(php_http_object_class_entry, ZEND_STRL("EH_THROW"), EH_THROW TSRMLS_CC); + zend_declare_class_constant_long(php_http_object_get_class_entry(), ZEND_STRL("EH_NORMAL"), EH_NORMAL TSRMLS_CC); + zend_declare_class_constant_long(php_http_object_get_class_entry(), ZEND_STRL("EH_SUPPRESS"), EH_SUPPRESS TSRMLS_CC); + zend_declare_class_constant_long(php_http_object_get_class_entry(), ZEND_STRL("EH_THROW"), EH_THROW TSRMLS_CC); return SUCCESS; } diff --git a/php_http_object.h b/php_http_object.h index 975d150..0ebd33c 100644 --- a/php_http_object.h +++ b/php_http_object.h @@ -15,19 +15,18 @@ typedef zend_object_value (*php_http_new_t)(zend_class_entry *ce, void *, void ** TSRMLS_DC); -extern STATUS php_http_new(zend_object_value *ov, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC); +PHP_HTTP_API STATUS php_http_new(zend_object_value *ov, zend_class_entry *ce, php_http_new_t create, zend_class_entry *parent_ce, void *intern_ptr, void **obj_ptr TSRMLS_DC); typedef struct php_http_object { zend_object zo; } php_http_object_t; -extern zend_class_entry *php_http_object_class_entry; -extern zend_function_entry php_http_object_method_entry[]; +zend_class_entry *php_http_object_get_class_entry(void); -extern PHP_MINIT_FUNCTION(http_object); +PHP_MINIT_FUNCTION(http_object); -extern zend_object_value php_http_object_new(zend_class_entry *ce TSRMLS_DC); -extern zend_object_value php_http_object_new_ex(zend_class_entry *ce, void *nothing, php_http_object_t **ptr TSRMLS_DC); +zend_object_value php_http_object_new(zend_class_entry *ce TSRMLS_DC); +zend_object_value php_http_object_new_ex(zend_class_entry *ce, void *nothing, php_http_object_t **ptr TSRMLS_DC); PHP_HTTP_API zend_error_handling_t php_http_object_get_error_handling(zval *object TSRMLS_DC); diff --git a/php_http_params.c b/php_http_params.c index 4b98448..cd7728a 100644 --- a/php_http_params.c +++ b/php_http_params.c @@ -313,8 +313,14 @@ PHP_HTTP_BEGIN_ARGS(offsetSet, 2) PHP_HTTP_ARG_VAL(value, 0) PHP_HTTP_END_ARGS; -zend_class_entry *php_http_params_class_entry; -zend_function_entry php_http_params_method_entry[] = { +static zend_class_entry *php_http_params_class_entry; + +zend_class_entry *php_http_params_get_class_entry(void) +{ + return php_http_params_class_entry; +} + +static zend_function_entry php_http_params_method_entry[] = { PHP_HTTP_PARAMS_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR|ZEND_ACC_FINAL) PHP_HTTP_PARAMS_ME(toArray, ZEND_ACC_PUBLIC) @@ -331,7 +337,7 @@ zend_function_entry php_http_params_method_entry[] = { PHP_MINIT_FUNCTION(http_params) { - PHP_HTTP_REGISTER_CLASS(http, Params, http_params, php_http_object_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http, Params, http_params, php_http_object_get_class_entry(), 0); zend_class_implements(php_http_params_class_entry TSRMLS_CC, 1, zend_ce_arrayaccess); @@ -392,7 +398,7 @@ static void free_sep(php_http_params_token_t **separator) { PHP_METHOD(HttpParams, __construct) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { zval *zcopy, *zparams = NULL, *param_sep = NULL, *arg_sep = NULL, *val_sep = NULL; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!/z/z/z/", &zparams, ¶m_sep, &arg_sep, &val_sep)) { diff --git a/php_http_params.h b/php_http_params.h index 487cfa4..a040139 100644 --- a/php_http_params.h +++ b/php_http_params.h @@ -31,8 +31,7 @@ PHP_HTTP_API php_http_buffer_t *php_http_params_to_string(php_http_buffer_t *buf typedef php_http_object_t php_http_params_object_t; -extern zend_class_entry *php_http_params_class_entry; -extern zend_function_entry php_http_params_method_entry[]; +zend_class_entry *php_http_params_get_class_entry(void); PHP_MINIT_FUNCTION(http_params); diff --git a/php_http_property_proxy.c b/php_http_property_proxy.c index 43ec709..4ec80ad 100644 --- a/php_http_property_proxy.c +++ b/php_http_property_proxy.c @@ -16,7 +16,7 @@ # define PHP_HTTP_PPDBG 0 #endif -php_http_property_proxy_t *php_http_property_proxy_init(php_http_property_proxy_t *proxy, zval *object, zval *member, zval *parent TSRMLS_DC) +PHP_HTTP_API php_http_property_proxy_t *php_http_property_proxy_init(php_http_property_proxy_t *proxy, zval *object, zval *member, zval *parent TSRMLS_DC) { if (!proxy) { proxy = emalloc(sizeof(*proxy)); @@ -24,7 +24,7 @@ php_http_property_proxy_t *php_http_property_proxy_init(php_http_property_proxy_ memset(proxy, 0, sizeof(*proxy)); MAKE_STD_ZVAL(proxy->myself); - ZVAL_OBJVAL(proxy->myself, php_http_property_proxy_object_new_ex(php_http_property_proxy_class_entry, proxy, NULL TSRMLS_CC), 0); + ZVAL_OBJVAL(proxy->myself, php_http_property_proxy_object_new_ex(php_http_property_proxy_get_class_entry(), proxy, NULL TSRMLS_CC), 0); Z_ADDREF_P(object); proxy->object = object; proxy->member = php_http_ztyp(IS_STRING, member); @@ -39,7 +39,7 @@ php_http_property_proxy_t *php_http_property_proxy_init(php_http_property_proxy_ return proxy; } -void php_http_property_proxy_dtor(php_http_property_proxy_t *proxy) +PHP_HTTP_API void php_http_property_proxy_dtor(php_http_property_proxy_t *proxy) { zval_ptr_dtor(&proxy->object); zval_ptr_dtor(&proxy->member); @@ -49,7 +49,7 @@ void php_http_property_proxy_dtor(php_http_property_proxy_t *proxy) } } -void php_http_property_proxy_free(php_http_property_proxy_t **proxy) +PHP_HTTP_API void php_http_property_proxy_free(php_http_property_proxy_t **proxy) { if (*proxy) { php_http_property_proxy_dtor(*proxy); @@ -65,11 +65,18 @@ void php_http_property_proxy_free(php_http_property_proxy_t **proxy) PHP_HTTP_EMPTY_ARGS(__construct); -zend_class_entry *php_http_property_proxy_class_entry; -zend_function_entry php_http_property_proxy_method_entry[] = { +static zend_class_entry *php_http_property_proxy_class_entry; + +zend_class_entry *php_http_property_proxy_get_class_entry(void) +{ + return php_http_property_proxy_class_entry; +} + +static zend_function_entry php_http_property_proxy_method_entry[] = { PHP_HTTP_PP_ME(__construct, ZEND_ACC_FINAL|ZEND_ACC_PRIVATE) EMPTY_FUNCTION_ENTRY }; + static zend_object_handlers php_http_property_proxy_object_handlers; zend_object_value php_http_property_proxy_object_new(zend_class_entry *ce TSRMLS_DC) diff --git a/php_http_property_proxy.h b/php_http_property_proxy.h index 30b518e..518cb5a 100644 --- a/php_http_property_proxy.h +++ b/php_http_property_proxy.h @@ -29,12 +29,11 @@ typedef struct php_http_property_proxy_object { php_http_property_proxy_t *proxy; } php_http_property_proxy_object_t; -extern zend_class_entry *php_http_property_proxy_class_entry; -extern zend_function_entry php_http_property_proxy_method_entry[]; +zend_class_entry *php_http_property_proxy_get_class_entry(void); -extern zend_object_value php_http_property_proxy_object_new(zend_class_entry *ce TSRMLS_DC); -extern zend_object_value php_http_property_proxy_object_new_ex(zend_class_entry *ce, php_http_property_proxy_t *proxy, php_http_property_proxy_object_t **ptr TSRMLS_DC); -extern void php_http_property_proxy_object_free(void *object TSRMLS_DC); +zend_object_value php_http_property_proxy_object_new(zend_class_entry *ce TSRMLS_DC); +zend_object_value php_http_property_proxy_object_new_ex(zend_class_entry *ce, php_http_property_proxy_t *proxy, php_http_property_proxy_object_t **ptr TSRMLS_DC); +void php_http_property_proxy_object_free(void *object TSRMLS_DC); PHP_METHOD(HttpPropertyProxy, __construct); diff --git a/php_http_querystring.c b/php_http_querystring.c index 177701b..8c65a7a 100644 --- a/php_http_querystring.c +++ b/php_http_querystring.c @@ -28,20 +28,20 @@ static inline void php_http_querystring_set(zval *instance, zval *params, int fl zval *qa; if (flags & QS_MERGE) { - qa = php_http_zsep(1, IS_ARRAY, zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0 TSRMLS_CC)); + qa = php_http_zsep(1, IS_ARRAY, zend_read_property(php_http_querystring_get_class_entry(), instance, ZEND_STRL("queryArray"), 0 TSRMLS_CC)); } else { MAKE_STD_ZVAL(qa); array_init(qa); } php_http_querystring_update(qa, params, NULL TSRMLS_CC); - zend_update_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), qa TSRMLS_CC); + zend_update_property(php_http_querystring_get_class_entry(), instance, ZEND_STRL("queryArray"), qa TSRMLS_CC); zval_ptr_dtor(&qa); } static inline void php_http_querystring_str(zval *instance, zval *return_value TSRMLS_DC) { - zval *qa = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0 TSRMLS_CC); + zval *qa = zend_read_property(php_http_querystring_get_class_entry(), instance, ZEND_STRL("queryArray"), 0 TSRMLS_CC); if (Z_TYPE_P(qa) == IS_ARRAY) { php_http_querystring_update(qa, NULL, return_value TSRMLS_CC); @@ -52,7 +52,7 @@ static inline void php_http_querystring_str(zval *instance, zval *return_value T static inline void php_http_querystring_get(zval *this_ptr, int type, char *name, uint name_len, zval *defval, zend_bool del, zval *return_value TSRMLS_DC) { - zval **arrval, *qarray = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC); + zval **arrval, *qarray = zend_read_property(php_http_querystring_get_class_entry(), getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC); if ((Z_TYPE_P(qarray) == IS_ARRAY) && (SUCCESS == zend_symtable_find(Z_ARRVAL_P(qarray), name, name_len + 1, (void *) &arrval))) { if (type) { @@ -157,8 +157,8 @@ PHP_HTTP_API STATUS php_http_querystring_update(zval *qarray, zval *params, zval ZVAL_NULL(&zv); /* squeeze the hash out of the zval */ - if (Z_TYPE_P(params) == IS_OBJECT && instanceof_function(Z_OBJCE_P(params), php_http_querystring_class_entry TSRMLS_CC)) { - zv_ptr = php_http_ztyp(IS_ARRAY, zend_read_property(php_http_querystring_class_entry, params, ZEND_STRL("queryArray"), 0 TSRMLS_CC)); + if (Z_TYPE_P(params) == IS_OBJECT && instanceof_function(Z_OBJCE_P(params), php_http_querystring_get_class_entry() TSRMLS_CC)) { + zv_ptr = php_http_ztyp(IS_ARRAY, zend_read_property(php_http_querystring_get_class_entry(), params, ZEND_STRL("queryArray"), 0 TSRMLS_CC)); ptr = Z_ARRVAL_P(zv_ptr); } else if (Z_TYPE_P(params) == IS_OBJECT || Z_TYPE_P(params) == IS_ARRAY) { ptr = HASH_OF(params); @@ -317,8 +317,14 @@ PHP_HTTP_END_ARGS; PHP_HTTP_EMPTY_ARGS(getIterator); -zend_class_entry *php_http_querystring_class_entry; -zend_function_entry php_http_querystring_method_entry[] = { +static zend_class_entry *php_http_querystring_class_entry; + +zend_class_entry *php_http_querystring_get_class_entry(void) +{ + return php_http_querystring_class_entry; +} + +static zend_function_entry php_http_querystring_method_entry[] = { PHP_HTTP_QUERYSTRING_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR|ZEND_ACC_FINAL) PHP_HTTP_QUERYSTRING_ME(toArray, ZEND_ACC_PUBLIC) @@ -358,7 +364,7 @@ zend_function_entry php_http_querystring_method_entry[] = { PHP_MINIT_FUNCTION(http_querystring) { - PHP_HTTP_REGISTER_CLASS(http, QueryString, http_querystring, php_http_object_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http, QueryString, http_querystring, php_http_object_get_class_entry(), 0); zend_class_implements(php_http_querystring_class_entry TSRMLS_CC, 3, zend_ce_serializable, zend_ce_arrayaccess, zend_ce_aggregate); @@ -379,9 +385,9 @@ PHP_METHOD(HttpQueryString, __construct) { zval *params = NULL; - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", ¶ms)) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { php_http_querystring_set(getThis(), params, 0 TSRMLS_CC); } end_error_handling(); } @@ -390,9 +396,9 @@ PHP_METHOD(HttpQueryString, __construct) PHP_METHOD(HttpQueryString, getGlobalInstance) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters_none()) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { zval *instance = *zend_std_get_static_property(php_http_querystring_class_entry, ZEND_STRL("instance"), 0, NULL TSRMLS_CC); if (Z_TYPE_P(instance) != IS_OBJECT) { @@ -424,9 +430,9 @@ PHP_METHOD(HttpQueryString, getGlobalInstance) PHP_METHOD(HttpQueryString, getIterator) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters_none()) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { zval *retval = NULL, *qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC); object_init_ex(return_value, spl_ce_RecursiveArrayIterator); @@ -512,9 +518,9 @@ PHP_METHOD(HttpQueryString, mod) { zval *params; - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", ¶ms)) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { ZVAL_OBJVAL(return_value, Z_OBJ_HT_P(getThis())->clone_obj(getThis() TSRMLS_CC), 0); php_http_querystring_set(return_value, params, QS_MERGE TSRMLS_CC); } end_error_handling(); @@ -543,12 +549,12 @@ PHP_HTTP_QUERYSTRING_GETTER(getObject, IS_OBJECT); #ifdef PHP_HTTP_HAVE_ICONV PHP_METHOD(HttpQueryString, xlate) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { char *ie, *oe; int ie_len, oe_len; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &ie, &ie_len, &oe, &oe_len)) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { zval *na, *qa = php_http_ztyp(IS_ARRAY, zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC)); MAKE_STD_ZVAL(na); @@ -580,9 +586,9 @@ PHP_METHOD(HttpQueryString, unserialize) { zval *serialized; - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &serialized)) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { if (Z_TYPE_P(serialized) == IS_STRING) { php_http_querystring_set(getThis(), serialized, 0 TSRMLS_CC); } else { diff --git a/php_http_querystring.h b/php_http_querystring.h index 9331fcd..e34ccc0 100644 --- a/php_http_querystring.h +++ b/php_http_querystring.h @@ -28,10 +28,9 @@ typedef php_http_object_t php_http_querystring_object_t; #define PHP_HTTP_QUERYSTRING_TYPE_ARRAY IS_ARRAY #define PHP_HTTP_QUERYSTRING_TYPE_OBJECT IS_OBJECT -extern zend_class_entry *php_http_querystring_class_entry; -extern zend_function_entry php_http_querystring_method_entry[]; +zend_class_entry *php_http_querystring_get_class_entry(void); -extern PHP_MINIT_FUNCTION(http_querystring); +PHP_MINIT_FUNCTION(http_querystring); #define php_http_querystring_object_new php_http_object_new #define php_http_querystring_object_new_ex php_http_object_new_ex diff --git a/php_http_serf.h b/php_http_serf.h deleted file mode 100644 index 9200fd6..0000000 --- a/php_http_serf.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - +--------------------------------------------------------------------+ - | PECL :: http | - +--------------------------------------------------------------------+ - | Redistribution and use in source and binary forms, with or without | - | modification, are permitted provided that the conditions mentioned | - | in the accompanying LICENSE file are met. | - +--------------------------------------------------------------------+ - | Copyright (c) 2004-2011, Michael Wallner | - +--------------------------------------------------------------------+ -*/ - -#ifndef PHP_HTTP_SERF_H -#define PHP_HTTP_SERF_H - -#if PHP_HTTP_HAVE_SERF - -php_http_request_ops_t *php_http_serf_get_request_ops(void); - -PHP_MINIT_FUNCTION(http_serf); -PHP_MSHUTDOWN_FUNCTION(http_serf); - -extern zend_class_entry *php_http_serf_class_entry; -extern zend_function_entry php_http_serf_method_entry[]; - -#define php_http_serf_new php_http_object_new - -PHP_METHOD(HttpSERF, __construct); - -#endif /* PHP_HTTP_HAVE_SERF */ -#endif /* PHP_HTTP_SERF_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ - diff --git a/php_http_url.c b/php_http_url.c index 40ed57e..c8fe62e 100644 --- a/php_http_url.c +++ b/php_http_url.c @@ -466,8 +466,14 @@ PHP_HTTP_BEGIN_ARGS(mod, 1) PHP_HTTP_ARG_VAL(flags, 0) PHP_HTTP_END_ARGS; -zend_class_entry *php_http_url_class_entry; -zend_function_entry php_http_url_method_entry[] = { +static zend_class_entry *php_http_url_class_entry; + +zend_class_entry *php_http_url_get_class_entry(void) +{ + return php_http_url_class_entry; +} + +static zend_function_entry php_http_url_method_entry[] = { PHP_HTTP_URL_ME(__construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_HTTP_URL_ME(mod, ZEND_ACC_PUBLIC) PHP_HTTP_URL_ME(toString, ZEND_ACC_PUBLIC) @@ -478,12 +484,12 @@ zend_function_entry php_http_url_method_entry[] = { PHP_METHOD(HttpUrl, __construct) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { zval *new_url = NULL, *old_url = NULL; long flags = PHP_HTTP_URL_FROM_ENV; if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z!z!l", &old_url, &new_url, &flags)) { - with_error_handling(EH_THROW, php_http_exception_class_entry) { + with_error_handling(EH_THROW, php_http_exception_get_class_entry()) { php_url *res_purl, *new_purl = NULL, *old_purl = NULL; if (new_url) { @@ -613,7 +619,7 @@ PHP_METHOD(HttpUrl, toArray) PHP_MINIT_FUNCTION(http_url) { - PHP_HTTP_REGISTER_CLASS(http, Url, http_url, php_http_object_class_entry, 0); + PHP_HTTP_REGISTER_CLASS(http, Url, http_url, php_http_object_get_class_entry(), 0); zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("scheme"), ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("user"), ZEND_ACC_PUBLIC TSRMLS_CC); diff --git a/php_http_url.h b/php_http_url.h index 4b7657c..a482d23 100644 --- a/php_http_url.h +++ b/php_http_url.h @@ -153,8 +153,7 @@ static inline HashTable *php_http_url_to_struct(php_url *url, zval *strct TSRMLS return Z_ARRVAL(arr); } -extern zend_class_entry *php_http_url_class_entry; -extern zend_function_entry php_http_url_method_entry[]; +zend_class_entry *php_http_url_get_class_entry(void); #define php_http_url_object_new php_http_object_new #define php_http_url_object_new_ex php_http_object_new_ex @@ -164,7 +163,7 @@ PHP_METHOD(HttpUrl, mod); PHP_METHOD(HttpUrl, toString); PHP_METHOD(HttpUrl, toArray); -extern PHP_MINIT_FUNCTION(http_url); +PHP_MINIT_FUNCTION(http_url); #endif