code cleanup
authorMichael Wallner <mike@php.net>
Tue, 3 Apr 2012 10:00:01 +0000 (10:00 +0000)
committerMichael Wallner <mike@php.net>
Tue, 3 Apr 2012 10:00:01 +0000 (10:00 +0000)
53 files changed:
php_http.h
php_http_client.c
php_http_client_datashare.c
php_http_client_factory.c
php_http_client_factory.h
php_http_client_interface.c
php_http_client_interface.h
php_http_client_pool.c
php_http_client_request.c
php_http_client_response.c
php_http_client_response.h
php_http_cookie.c
php_http_cookie.h
php_http_curl.h
php_http_curl_client.c
php_http_curl_client.h
php_http_curl_client_datashare.c
php_http_curl_client_datashare.h
php_http_curl_client_pool.c
php_http_curl_client_pool.h
php_http_encoding.c
php_http_encoding.h
php_http_env.c
php_http_env.h
php_http_env_request.c
php_http_env_request.h
php_http_env_response.c
php_http_env_response.h
php_http_exception.c
php_http_exception.h
php_http_filter.c
php_http_filter.h
php_http_fluently_callable.c [deleted file]
php_http_fluently_callable.h [deleted file]
php_http_headers.c
php_http_headers.h
php_http_message.c
php_http_message.h
php_http_message_body.c
php_http_message_body.h
php_http_misc.c
php_http_misc.h
php_http_object.c
php_http_object.h
php_http_params.c
php_http_params.h
php_http_property_proxy.c
php_http_property_proxy.h
php_http_querystring.c
php_http_querystring.h
php_http_serf.h [deleted file]
php_http_url.c
php_http_url.h

index 1fe67e96898f934ec8afd18a1a4beb2deae3ca4a..97c81f70f119dce5cce6ef6206f0601f2c569e06 100644 (file)
 
 #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 */
 
index 06e90bafd889e2e7815f9bc533ef7b9bec87737f..6f1c5fae4beeb3235fdbade03d103d704059a432 100644 (file)
@@ -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);
index 38719ece014916e8311d06e9d28cec8c3e4ba248..09d568ff939debbf93c51ac9e1b51fe17502db21 100644 (file)
@@ -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;
index aba4b6444b9848d0049f7e90b18dc7703b8b9511..a7052115b8ef6205310a043f544de87c3918d25e 100644 (file)
@@ -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);
index a31663dcd4fdfdbd1494fc41a31ac00d858d81b1..ffa4f8e037296f86715d8ca3354b521bf04340db 100644 (file)
@@ -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
 
index 691250891a0584c13a85e785babfc5290d337a88..3040e769f783f7d9428abf6f9b8ecd475bdb6622 100644 (file)
 
 #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}
 };
 
index 797945a2a1ad05a46ff548434ab36e1229ff2cd2..2bbd7368159dce594943445a2ec1a056ebd76f39 100644 (file)
     +--------------------------------------------------------------------+
 */
 
-#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);
 
index a3fbf5e5ca3f57e3000fbd9743d7a960db92e1c3..5eba4c7db7959b909cc8641ae17c0a04b55a62f7 100644 (file)
@@ -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;
index 3059444d5c5a7fbe83cbd248e759c287c8956bb6..c073512ed5f02871e4054bb9b1cec20e4dc1ef86 100644 (file)
@@ -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);
 
index 663ce8bba34adceff09af13e0d00ecbe311b2c62..675f600fe6930986417bb2b5767284d6557256d5 100644 (file)
@@ -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;
 }
index 704f7276cd27938e3e8d0dc9a5fb5486b846c67f..4a304eda00e389a831d1900d6f7780d3f59e6813 100644 (file)
@@ -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);
 
index d46f4146e9f8782ddecfdd6ed14b6bfb8702d00c..ef0947ea597d224863d1c4cd09edba79414fb377 100644 (file)
@@ -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;
index 340084d9c459544d66185021ccb240f9687ff265..d524fee3580a2088e46c78a31816a33a629eca11 100644 (file)
@@ -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;
index 709ba2272e36ec06191e6cdbc178bf90d6077ab2..f7116cd8b94a6b75528155168db310e48243cb34 100644 (file)
@@ -18,8 +18,8 @@
 #include <curl/curl.h>
 #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 */
 
index a2e0d3fc4ceb07eb9524b0a49182e53ddf1a8032..ce47f6b2163fb8caa1be17cdb761fd1104fe14c1 100644 (file)
@@ -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
 };
index b3d8a4a80165c601356eb8b8b0c911e03614eee6..4baddf1f4f7ee62bd0822aaf7e5ef9011f6af8fe 100644 (file)
@@ -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);
 
index 1b47eb56e786163debe707816a8269bbaac3638b..cc370bad0f2817ed639a6eb89288d4196384bbcc 100644 (file)
@@ -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
 };
 
index d02796ebc70a64845e83405a0cc48dc5854282c5..5d2a0099abf5ce931f19bc95f00e8587c3dc71a4 100644 (file)
 
 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);
 
index 61a00f17a7f6b3597c63a057d1abdc3b924a39cc..ea1bace5f1efacd9b6f1b02345e37a84cd073e32 100644 (file)
@@ -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
 };
 
index c0e5eb951882c7b41cc53d32de37deb1b73686ea..69203fb43653cf97c27ad226e3743d3d72a4ef6a 100644 (file)
 
 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 {
index bc3a1bdc6f4036353b8516b956aa4cc75e57b672..4a71c80074d24f1ea902a641df09810c13653312 100644 (file)
@@ -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;
index 603880a7ca94fb02f3f033ab9cd80d30b85831f5..24d014664a0abb9b9128cb1340206c3ccee92e03 100644 (file)
@@ -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);
index f1ebf1c30e124668d8d05b37304942ae95ede547..5df1e5bb8edb4ae29d626d8724e2826bcfc8fa79 100644 (file)
@@ -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);
                        }
                }
index be0215b551a2eb98058f3a838c3cbd3a929b778c..4326054b8ec1b8855e26b3f5b7a8239b64b95974 100644 (file)
@@ -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);
index cd9dae08d35e182c0db851ae4c569f4c03b332fb..3e88bd0b7cea4f8cf3631901156bcdf45e94260c 100644 (file)
@@ -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);
index cc596647145bb92f64d4a0688e4ed4db9ed2c474..7b529a1dd00dd7023d86f0b41ee37e3470c4ce91 100644 (file)
@@ -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);
index 40b74ef0d8a218744ac319d93038215e9c2aadac..5f493a6234b6c4cb3316a598be196671564b0955 100644 (file)
@@ -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);
index ab5ee5c2c12d54305442eebeed128d3b93fd6d95..1031daa1ce2ed2be1cf7e9efb69fe4f57a02683b 100644 (file)
@@ -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);
index cd5dcfe7b2c4a3b8bb877d1584f553286e835253..2c6dc1f272e6f270e7a4693bbaf3835f4fce8c49 100644 (file)
 #      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;
index ccc3aaa79a705640615314f0e2a9cf941a62c393..f48f9b499ca5775459b518dcc3b9fb078ece0d1b 100644 (file)
 #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);
 
index 2c5335848910682695489a3a8576d52e3dad9016..ae426277589dbe2524cd7d563ff979e39f32af16 100644 (file)
@@ -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
 };
 
index 4ba7ad33543826b275a2d012df2f23d102bede0a..4b4806d3be99536c98add77183a49b2e93053b14 100644 (file)
@@ -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 (file)
index 2f674b8..0000000
+++ /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 (file)
index 9b4650f..0000000
+++ /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 */
index 226c763472253b7ad5cf77daf4d9919a17bc8a34..51a6997838eb802589bc22266f20e2c1115f32b7 100644 (file)
@@ -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
index bb6b19f8bc95f4c3f2d977f956f739ca35a63eae..0d67f127d1fa7d6c9b39de8b65a7002970bc89d3 100644 (file)
 
 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);
 
index 42ebe42a0889b240f4e63fb25299c193cc23d40d..f8b3a4d6a67bcf60efabb352a0d0854564fb3699 100644 (file)
@@ -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);
 
index c78101d12c1f5e4c7b74d1db04fa9ef5eab59ef6..cd2615eb3c3a9aa73c15a8f270342cd1efab1da4 100644 (file)
@@ -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);
index 5bcc958e7817ec9c6d83acb585ac496bc0cd36d1..c4c3f9d2a3508f65cf909084012afac1446ff531 100644 (file)
@@ -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);
 
index 61fdb7580c43ac01e95a3ac07cbca28d120ab1cc..4e3fae97da25fdbd6ba90bbee7d3cb93f0b8ad35 100644 (file)
@@ -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);
index c4661b7befc2988875ba6cacfbbbaf96cff83c96..bb9906252de18cafed51b29195754e0bb552677f 100644 (file)
@@ -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);
                        }
 
index 33be199507bcc68022032bd11af99267417507ee..16a7be8255d8d3c753dcfd73c77a3f74e9a348ce 100644 (file)
@@ -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 */
 
index 602ebaa9324fbb195a1fdaa7233f91f9bc6c2906..c278e6bc08b9b75c700b198bf386173154ffcf49 100644 (file)
@@ -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;
 }
index 975d1503743c37d6011c21371d1481da9cf97ca1..0ebd33cc03a99509cf93b408c20979f12ea6c534 100644 (file)
 
 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);
 
index 4b9844820542bbe9c53f0c92f354d2ece9edca7d..cd7728a0fe1bf60a44529ff943229a622b021d00 100644 (file)
@@ -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, &param_sep, &arg_sep, &val_sep)) {
index 487cfa4bdcaba35c85e77096cf39bfb1fa36aaf0..a040139c38acc0a07b540ec9b6814170cac64f7f 100644 (file)
@@ -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);
 
index 43ec7095c56f1054959122dc923e1da9013a0449..4ec80addee83b203884e988f7a392c45039a7027 100644 (file)
@@ -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)
index 30b518e74929d38510fb03a8108d2e04b5d42457..518cb5a5f3b654a66a7b8652de716df7bb1ad767 100644 (file)
@@ -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);
 
index 177701b8fc29fb26bfd46c3b0babc8a36bb2f5f2..8c65a7a928a355fa07da96d03b174886a5a68434 100644 (file)
@@ -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", &params)) {
-                       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", &params)) {
-                       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 {
index 9331fcd3098a7d261fab51dd03bb7a455e03e39d..e34ccc004e5fd0ec77d417f30942a220050659c3 100644 (file)
@@ -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 (file)
index 9200fd6..0000000
+++ /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 <mike@php.net>            |
-    +--------------------------------------------------------------------+
-*/
-
-#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
- */
-
index 40ed57ec8c9fb43fe92ac6fb5c3fd7c578f0a49f..c8fe62e85e37819f5db7dcb2504ec08efa669a14 100644 (file)
@@ -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);
index 4b7657c38967dfa36a809e2982677f878328da97..a482d2382184f8269015cf7a788df166c32059a6 100644 (file)
@@ -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