*/
PHP_METHOD(HttpMessage, setHeaders)
{
- zval *new_headers, old_headers;
+ zval *new_headers = NULL, old_headers;
getObject(http_message_object, obj);
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/", &new_headers)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a/!", &new_headers)) {
return;
}
zend_hash_clean(&obj->message->hdrs);
- INIT_ZARR(old_headers, &obj->message->hdrs);
- array_copy(new_headers, &old_headers);
+ if (new_headers) {
+ INIT_ZARR(old_headers, &obj->message->hdrs);
+ array_copy(new_headers, &old_headers);
+ }
}
/* }}} */
long flags = 0;
zval *allowed_extras_array = NULL;
- if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|la", &flags, &allowed_extras_array)) {
+ if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|la!", &flags, &allowed_extras_array)) {
int i = 0;
ulong idx = 0;
char *key = NULL, **allowed_extras = NULL;
char *etag;
zval *the_data;
- if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &the_data)) {
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/", &the_data)) {
RETURN_FALSE;
}
if (Z_TYPE_P(the_data) != IS_STRING) {