BOUNDARY_OPEN(body);
php_http_message_body_appendf(
body,
- "Content-Disposition: form-data; name=\"%s\"" PHP_HTTP_CRLF
- "" PHP_HTTP_CRLF,
- safe_name);
+ "Content-Disposition: form-data; name=\"%s\"" PHP_HTTP_CRLF
+ "" PHP_HTTP_CRLF,
+ safe_name
+ );
php_http_message_body_append(body, value_str, value_len);
BOUNDARY_CLOSE(body);
if (tef) {
php_stream_filter_remove(tef, 1 TSRMLS_CC);
- php_stream_filter_free(tef TSRMLS_CC);
}
efree(safe_name);
if (!ht->nApplyCount) {
++ht->nApplyCount;
FOREACH_HASH_KEYVAL(pos, ht, key, val) {
- char *str = format_key(key.type, key.str, key.num, name);
- if (SUCCESS != add_recursive_files(body, str, *val)) {
+ if (Z_TYPE_PP(val) == IS_ARRAY || Z_TYPE_PP(val) == IS_OBJECT) {
+ char *str = format_key(key.type, key.str, key.num, name);
+
+ if (SUCCESS != add_recursive_files(body, str, *val)) {
+ efree(str);
+ --ht->nApplyCount;
+ return FAILURE;
+ }
efree(str);
- --ht->nApplyCount;
- return FAILURE;
}
- efree(str);
}
--ht->nApplyCount;
}
} else {
zval *tmp = php_http_ztyp(IS_STRING, *zdata);
- if ((stream = php_stream_temp_new())) {
- php_stream_write(stream, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
- }
+ stream = php_stream_memory_open(TEMP_STREAM_READONLY, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
zval_ptr_dtor(&tmp);
}
} else {
efree(key);
zval_ptr_dtor(&znc);
+ zval_ptr_dtor(&ztc);
zval_ptr_dtor(&zfc);
if (!zdata || Z_TYPE_PP(zdata) != IS_RESOURCE) {
php_stream_close(stream);
PHP_HTTP_END_ARGS;
PHP_HTTP_BEGIN_ARGS(add, 0)
- PHP_HTTP_ARG_VAL(fields, 0)
- PHP_HTTP_ARG_VAL(files, 0)
+ PHP_HTTP_ARG_ARR(fields, 1, 0)
+ PHP_HTTP_ARG_ARR(files, 1, 0)
PHP_HTTP_END_ARGS;
PHP_HTTP_EMPTY_ARGS(etag);
{
HashTable *fields = NULL, *files = NULL;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|hh", &fields, &files)) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|h!h!", &fields, &files)) {
php_http_message_body_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
RETURN_SUCCESS(php_http_message_body_add(obj->body, fields, files));
#define PHP_HTTP_ARGS(class, method) args_for_ ##class## _ ##method
#define PHP_HTTP_ARG_VAL(name, pass_ref) ZEND_ARG_INFO(pass_ref, name)
#define PHP_HTTP_ARG_OBJ(class, name, allow_null) ZEND_ARG_OBJ_INFO(0, name, class, allow_null)
+#define PHP_HTTP_ARG_ARR(name, allow_null, pass_ref) ZEND_ARG_ARRAY_INFO(pass_ref, name, allow_null)
#define EMPTY_FUNCTION_ENTRY {NULL, NULL, NULL, 0, 0}