prepare v4.2.5
[m6w6/ext-http] / src / php_http_client_response.c
index b1377fe64c7b3d49aed4604c992501de9b4026c3..722b4e03ac1b58494593f0a35430098f76be3b72 100644 (file)
 
 #include "php_http_api.h"
 
+static zend_class_entry *php_http_client_response_class_entry;
+zend_class_entry *php_http_get_client_response_class_entry(void)
+{
+       return php_http_client_response_class_entry;
+}
+
 ZEND_BEGIN_ARG_INFO_EX(ai_HttpClientResponse_getCookies, 0, 0, 0)
        ZEND_ARG_INFO(0, flags)
        ZEND_ARG_INFO(0, allowed_extras)
@@ -57,7 +63,7 @@ static PHP_METHOD(HttpClientResponse, getCookies)
                                if ((list = php_http_cookie_list_parse(NULL, zs->val, zs->len, flags, allowed_extras))) {
                                        zval cookie;
 
-                                       ZVAL_OBJ(&cookie, &php_http_cookie_object_new_ex(php_http_cookie_class_entry, list)->zo);
+                                       ZVAL_OBJ(&cookie, &php_http_cookie_object_new_ex(php_http_cookie_get_class_entry(), list)->zo);
                                        add_next_index_zval(return_value, &cookie);
                                }
                                zend_string_release(zs);
@@ -69,7 +75,7 @@ static PHP_METHOD(HttpClientResponse, getCookies)
                        if ((list = php_http_cookie_list_parse(NULL, zs->val, zs->len, flags, allowed_extras))) {
                                zval cookie;
 
-                               ZVAL_OBJ(&cookie, &php_http_cookie_object_new_ex(php_http_cookie_class_entry, list)->zo);
+                               ZVAL_OBJ(&cookie, &php_http_cookie_object_new_ex(php_http_cookie_get_class_entry(), list)->zo);
                                add_next_index_zval(return_value, &cookie);
                        }
                        zend_string_release(zs);
@@ -95,16 +101,16 @@ static PHP_METHOD(HttpClientResponse, getTransferInfo)
 
        php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &info_name, &info_len), invalid_arg, return);
 
-       info = zend_read_property(php_http_client_response_class_entry, getThis(), ZEND_STRL("transferInfo"), 0, &info_tmp);
+       info = zend_read_property(php_http_client_response_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("transferInfo"), 0, &info_tmp);
 
        /* request completed? */
        if (Z_TYPE_P(info) != IS_OBJECT) {
-               php_http_throw(bad_method_call, "Incomplete state", NULL);
+               php_http_throw(bad_method_call, "Incomplete state");
                return;
        }
 
        if (info_len && info_name) {
-               info = zend_read_property(NULL, info, php_http_pretty_key(info_name, info_len, 0, 0), info_len, 0, &info_name_tmp);
+               info = zend_read_property(NULL, Z_OBJ_P(info), php_http_pretty_key(info_name, info_len, 0, 0), info_len, 0, &info_name_tmp);
 
                if (!info) {
                        php_http_throw(unexpected_val, "Could not find transfer info with name '%s'", info_name);
@@ -121,14 +127,12 @@ static zend_function_entry php_http_client_response_methods[] = {
        EMPTY_FUNCTION_ENTRY
 };
 
-zend_class_entry *php_http_client_response_class_entry;
-
 PHP_MINIT_FUNCTION(http_client_response)
 {
        zend_class_entry ce = {0};
 
        INIT_NS_CLASS_ENTRY(ce, "http\\Client", "Response", php_http_client_response_methods);
-       php_http_client_response_class_entry = zend_register_internal_class_ex(&ce, php_http_message_class_entry);
+       php_http_client_response_class_entry = zend_register_internal_class_ex(&ce, php_http_message_get_class_entry());
 
        zend_declare_property_null(php_http_client_response_class_entry, ZEND_STRL("transferInfo"), ZEND_ACC_PROTECTED);