| 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: http_message_api.c 298689 2010-04-28 06:50:06Z mike $ */
-
-#include "php_http.h"
-
-#include <main/SAPI.h>
-#include <ext/spl/spl_iterators.h>
-#include <Zend/zend_interfaces.h>
+#include "php_http_api.h"
PHP_HTTP_API zend_bool php_http_message_info_callback(php_http_message_t **message, HashTable **headers, php_http_info_t *info TSRMLS_DC)
{
zval *ret = NULL, **header;
char *key = php_http_pretty_key(estrndup(key_str, key_len), key_len, 1, 1);
- if (SUCCESS == zend_hash_find(&msg->hdrs, key, key_len + 1, (void *) &header)) {
+ if (SUCCESS == zend_symtable_find(&msg->hdrs, key, key_len + 1, (void *) &header)) {
if (join && Z_TYPE_PP(header) == IS_ARRAY) {
zval *header_str, **val;
HashPosition pos;
if (SUCCESS == php_http_message_object_get_prophandler(Z_STRVAL_P(copy), Z_STRLEN_P(copy), &handler)) {
zval_ptr_dtor(©);
- return &php_http_property_proxy_init(NULL, object, member TSRMLS_CC)->myself;
+ return &php_http_property_proxy_init(NULL, object, member, NULL TSRMLS_CC)->myself;
}
zval_ptr_dtor(©);
zval *return_value, *copy = php_http_ztyp(IS_STRING, member);
if (SUCCESS == php_http_message_object_get_prophandler(Z_STRVAL_P(copy), Z_STRLEN_P(copy), &handler)) {
- if (type == BP_VAR_W) {
- zval_ptr_dtor(©);
+ if (type == BP_VAR_R) {
+ ALLOC_ZVAL(return_value);
+ Z_SET_REFCOUNT_P(return_value, 0);
+ Z_UNSET_ISREF_P(return_value);
+
+ handler->read(obj, return_value TSRMLS_CC);
+ } else {
zend_error(E_ERROR, "Cannot access HttpMessage properties by reference or array key/index");
- return NULL;
+ return_value = NULL;
}
-
- ALLOC_ZVAL(return_value);
- Z_SET_REFCOUNT_P(return_value, 0);
- Z_UNSET_ISREF_P(return_value);
-
- handler->read(obj, return_value TSRMLS_CC);
-
} else {
return_value = zend_get_std_object_handlers()->read_property(object, member, type, literal_key TSRMLS_CC);
}
}
if (!zvalue) {
- zend_hash_del(&obj->message->hdrs, name, name_len + 1);
+ zend_symtable_del(&obj->message->hdrs, name, name_len + 1);
} else {
Z_ADDREF_P(zvalue);
- zend_hash_update(&obj->message->hdrs, name, name_len + 1, &zvalue, sizeof(void *), NULL);
+ zend_symtable_update(&obj->message->hdrs, name, name_len + 1, &zvalue, sizeof(void *), NULL);
}
efree(name);
}
convert_to_array(header);
zend_hash_next_index_insert(Z_ARRVAL_P(header), &zvalue, sizeof(void *), NULL);
} else {
- zend_hash_update(&obj->message->hdrs, name, name_len + 1, &zvalue, sizeof(void *), NULL);
+ zend_symtable_update(&obj->message->hdrs, name, name_len + 1, &zvalue, sizeof(void *), NULL);
}
efree(name);
}