cache only standard GET/HEAD by default
[m6w6/ext-http] / php_http_querystring.c
index de40a23f3944473cfee1cfcb99d6f814a6e62ca1..7c569de763b31414157d01e6c23f27c362a29cda 100644 (file)
@@ -6,17 +6,14 @@
     | modification, are permitted provided that the conditions mentioned |
     | in the accompanying LICENSE file are met.                          |
     +--------------------------------------------------------------------+
-    | Copyright (c) 2004-2010, Michael Wallner <mike@php.net>            |
+    | Copyright (c) 2004-2011, Michael Wallner <mike@php.net>            |
     +--------------------------------------------------------------------+
 */
 
-/* $Id$ */
+#include "php_http_api.h"
 
-#include "php_http.h"
-
-#include <main/php_variables.h>
+#include <php_variables.h>
 #include <ext/spl/spl_array.h>
-#include <Zend/zend_interfaces.h>
 
 #ifdef PHP_HTTP_HAVE_ICONV
 #      undef PHP_ATOM_INC
@@ -148,23 +145,22 @@ PHP_HTTP_API STATUS php_http_querystring_update(zval *qarray, zval *params, zval
                                                }
                                        }
                                } else {
+                                       zval *entry;
                                        /*
                                         * add
                                         */
                                        if (Z_TYPE_PP(params_entry) == IS_OBJECT) {
-                                               zval *new_array;
-
-                                               MAKE_STD_ZVAL(new_array);
-                                               array_init(new_array);
-                                               php_http_querystring_update(new_array, *params_entry, NULL TSRMLS_CC);
-                                               *params_entry = new_array;
+                                               MAKE_STD_ZVAL(entry);
+                                               array_init(entry);
+                                               php_http_querystring_update(entry, *params_entry, NULL TSRMLS_CC);
                                        } else {
                                                Z_ADDREF_PP(params_entry);
+                                               entry = *params_entry;
                                        }
                                        if (key.type == HASH_KEY_IS_STRING) {
-                                               add_assoc_zval_ex(qarray, key.str, key.len, *params_entry);
+                                               add_assoc_zval_ex(qarray, key.str, key.len, entry);
                                        } else {
-                                               add_index_zval(qarray, key.num, *params_entry);
+                                               add_index_zval(qarray, key.num, entry);
                                        }
                                }
                        }
@@ -181,7 +177,7 @@ PHP_HTTP_API STATUS php_http_querystring_update(zval *qarray, zval *params, zval
                char *s;
                size_t l;
 
-               if (SUCCESS == php_http_url_encode_hash(Z_ARRVAL_P(qarray), 0, NULL, 0, &s, &l TSRMLS_CC)) {
+               if (SUCCESS == php_http_url_encode_hash(Z_ARRVAL_P(qarray), NULL, 0, &s, &l TSRMLS_CC)) {
                        zval_dtor(outstring);
                        ZVAL_STRINGL(outstring, s, l, 0);
                } else {
@@ -302,7 +298,7 @@ PHP_MINIT_FUNCTION(http_querystring)
 {
        PHP_HTTP_REGISTER_CLASS(http, QueryString, http_querystring, php_http_object_class_entry, 0);
        
-       zend_class_implements(php_http_querystring_class_entry TSRMLS_CC, 4, php_http_fluently_callable_class_entry, zend_ce_serializable, zend_ce_arrayaccess, zend_ce_aggregate);
+       zend_class_implements(php_http_querystring_class_entry TSRMLS_CC, 3, zend_ce_serializable, zend_ce_arrayaccess, zend_ce_aggregate);
        
        zend_declare_property_null(php_http_querystring_class_entry, ZEND_STRL("instance"), (ZEND_ACC_STATIC|ZEND_ACC_PRIVATE) TSRMLS_CC);
        zend_declare_property_null(php_http_querystring_class_entry, ZEND_STRL("queryArray"), ZEND_ACC_PRIVATE TSRMLS_CC);
@@ -350,7 +346,7 @@ static inline void php_http_querystring_get(zval *this_ptr, int type, char *name
 {
        zval **arrval, *qarray = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
                
-       if ((Z_TYPE_P(qarray) == IS_ARRAY) && (SUCCESS == zend_hash_find(Z_ARRVAL_P(qarray), name, name_len + 1, (void *) &arrval))) {
+       if ((Z_TYPE_P(qarray) == IS_ARRAY) && (SUCCESS == zend_symtable_find(Z_ARRVAL_P(qarray), name, name_len + 1, (void *) &arrval))) {
                if (type) {
                        zval *value = php_http_ztyp(type, *arrval);
                        RETVAL_ZVAL(value, 1, 1);
@@ -599,7 +595,7 @@ PHP_METHOD(HttpQueryString, offsetGet)
                zval *qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
 
                if (Z_TYPE_P(qa) == IS_ARRAY
-               &&      SUCCESS == zend_hash_find(Z_ARRVAL_P(qa), offset_str, offset_len + 1, (void *) &value)
+               &&      SUCCESS == zend_symtable_find(Z_ARRVAL_P(qa), offset_str, offset_len + 1, (void *) &value)
                ) {
                        RETVAL_ZVAL(*value, 1, 0);
                }
@@ -634,7 +630,7 @@ PHP_METHOD(HttpQueryString, offsetExists)
                zval *qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
 
                if (Z_TYPE_P(qa) == IS_ARRAY
-               &&      SUCCESS == zend_hash_find(Z_ARRVAL_P(qa), offset_str, offset_len + 1, (void *) &value)
+               &&      SUCCESS == zend_symtable_find(Z_ARRVAL_P(qa), offset_str, offset_len + 1, (void *) &value)
                &&      Z_TYPE_PP(value) != IS_NULL
                ) {
                        RETURN_TRUE;