-
- headers = GET_STATIC_PROP(headers);
-
- if (Z_TYPE_P(headers) != IS_ARRAY) {
- convert_to_array(headers);
- }
-
- /* delete header if value == null */
- if (!value || Z_TYPE_P(value) == IS_NULL) {
- RETURN_SUCCESS(zend_hash_del(Z_ARRVAL_P(headers), name, name_len + 1));
- }
-
- if (Z_TYPE_P(value) != IS_STRING) {
- convert_to_string_ex(&value);
- }
-
- /* convert old header to an array and add new one if header exists and replace == false */
- if (replace || (SUCCESS != zend_hash_find(Z_ARRVAL_P(headers), name, name_len + 1, (void **) &header))) {
- RETURN_SUCCESS(add_assoc_stringl_ex(headers, name, name_len + 1, Z_STRVAL_P(value), Z_STRLEN_P(value), 1));
- } else {
- convert_to_array(*header);
- RETURN_SUCCESS(add_next_index_stringl(*header, Z_STRVAL_P(value), Z_STRLEN_P(value), 1));
- }
+ http_send_header_zval_ex(name, name_len, &value, replace);
+ RETURN_TRUE;