char *deq = estrndup(Z_STRVAL_P(zv) + 1, deq_len);
zval_dtor(zv);
- ZVAL_STRINGL(zv, deq, deq_len, 0);
+ ZVAL_STR(zv, php_http_cs2zs(deq, deq_len));
}
- php_stripcslashes(Z_STRVAL_P(zv), &Z_STRLEN_P(zv));
+ php_stripcslashes(Z_STR_P(zv));
}
- static inline void prepare_escaped(zval *zv)
-static inline void quote_string(zval *zv, zend_bool force TSRMLS_DC)
++static inline void quote_string(zend_string **zs, zend_bool force)
{
- if (Z_TYPE_P(zv) == IS_STRING) {
- int len = Z_STRLEN_P(zv);
++ int len = (*zs)->len;
+
- Z_STRVAL_P(zv) = php_addcslashes(Z_STRVAL_P(zv), Z_STRLEN_P(zv), &Z_STRLEN_P(zv), 1,
- ZEND_STRL("\0..\37\173\\\"") TSRMLS_CC);
++ *zs = php_addcslashes(*zs, 1, ZEND_STRL("\0..\37\173\\\""));
+
- if (force || len != Z_STRLEN_P(zv) || strpbrk(Z_STRVAL_P(zv), "()<>@,;:\"[]?={} ")) {
- zval tmp = *zv;
- int len = Z_STRLEN_P(zv) + 2;
- char *str = emalloc(len + 1);
++ if (force || len != (*zs)->len || strpbrk((*zs)->val, "()<>@,;:\"[]?={} ")) {
++ int len = (*zs)->len + 2;
+
- str[0] = '"';
- memcpy(&str[1], Z_STRVAL_P(zv), Z_STRLEN_P(zv));
- str[len-1] = '"';
- str[len] = '\0';
++ *zs = zend_string_extend(*zs, len, 0);
+
- zval_dtor(&tmp);
- ZVAL_STRINGL(zv, str, len, 0);
++ memmove(&(*zs)->val[1], (*zs)->val, (*zs)->len);
++ (*zs)->val[0] = '"';
++ (*zs)->val[len-1] = '"';
++ (*zs)->val[len] = '\0';
++
++ zend_string_forget_hash_val(*zs);
+ }
+ }
+
-static inline void prepare_escaped(zval *zv TSRMLS_DC)
++/* if (Z_TYPE_P(zv) == IS_STRING) {
+ size_t len = Z_STRLEN_P(zv);
+ zend_string *stripped = php_addcslashes(Z_STR_P(zv), 0,
+ ZEND_STRL("\0..\37\173\\\""));
+
+ if (len != stripped->len || strpbrk(stripped->val, "()<>@,;:\"[]?={} ")) {
+ size_t len = stripped->len + 2;
+ char *str = emalloc(len + 1);
+
+ str[0] = '"';
+ memcpy(&str[1], stripped->val, stripped->len);
+ str[len-1] = '"';
+ str[len] = '\0';
+
+ zval_dtor(zv);
+ zend_string_release(stripped);
+ ZVAL_STR(zv, php_http_cs2zs(str, len));
+ } else {
+ zval_dtor(zv);
+ ZVAL_STR(zv, stripped);
+ }
++*/
++
++static inline void prepare_escaped(zval *zv)
+ {
+ if (Z_TYPE_P(zv) == IS_STRING) {
- quote_string(zv, 0 TSRMLS_CC);
++ quote_string(&Z_STR_P(zv), 0);
} else {
zval_dtor(zv);
ZVAL_EMPTY_STRING(zv);
}
}
- php_trim(str, len, " ><", 3, zv, 3 TSRMLS_CC);
+ static inline void sanitize_rfc5988(char *str, size_t len, zval *zv TSRMLS_DC)
+ {
++ zend_string *zs = zend_string_init(str, len, 0);
++
+ zval_dtor(zv);
++ ZVAL_STR(zv, php_trim(zs, " ><", 3, 3));
++ zend_string_release(zs);
+ }
+
+ static inline void prepare_rfc5988(zval *zv TSRMLS_DC)
+ {
+ if (Z_TYPE_P(zv) != IS_STRING) {
+ zval_dtor(zv);
+ ZVAL_EMPTY_STRING(zv);
+ }
+ }
+
static void utf8encode(zval *zv)
{
size_t pos, len = 0;
}
if (flags & PHP_HTTP_PARAMS_ESCAPED) {
- prepare_escaped(&zv);
+ if (flags & PHP_HTTP_PARAMS_RFC5988) {
- prepare_rfc5988(&zv TSRMLS_CC);
++ prepare_rfc5988(&zv);
+ } else {
- prepare_escaped(&zv TSRMLS_CC);
++ prepare_escaped(&zv);
+ }
}
- *new_key = Z_STRVAL(zv);
+ *new_key = estrndup(Z_STRVAL(zv), Z_STRLEN(zv));
*new_len = Z_STRLEN(zv);
+ zval_ptr_dtor(&zv);
}
-static inline void prepare_value(unsigned flags, zval *zv TSRMLS_DC)
+static inline void prepare_value(unsigned flags, zval *zv)
{
if (flags & PHP_HTTP_PARAMS_URLENCODED) {
- prepare_urlencoded(zv TSRMLS_CC);
+ prepare_urlencoded(zv);
}
if (flags & PHP_HTTP_PARAMS_ESCAPED) {
}
} else if (state->param.str) {
if (0 < (state->param.len = state->input.str - state->param.str)) {
- zval *prm, *arg, *val, *key;
+ zval prm, arg, val, key;
zend_bool rfc5987 = 0;
- MAKE_STD_ZVAL(key);
- ZVAL_NULL(key);
+ ZVAL_NULL(&key);
- sanitize_key(opts->flags, state->param.str, state->param.len, &key, &rfc5987);
- state->rfc5987 = rfc5987;
+ if (opts->flags & PHP_HTTP_PARAMS_RFC5988) {
- sanitize_rfc5988(state->param.str, state->param.len, key TSRMLS_CC);
++ sanitize_rfc5988(state->param.str, state->param.len, &key);
+ } else {
- sanitize_key(opts->flags, state->param.str, state->param.len, key, &rfc5987 TSRMLS_CC);
++ sanitize_key(opts->flags, state->param.str, state->param.len, &key, &rfc5987);
+ state->rfc5987 = rfc5987;
+ }
- if (Z_TYPE_P(key) != IS_STRING) {
- merge_param(params, key, &state->current.val, &state->current.args TSRMLS_CC);
- } else if (Z_STRLEN_P(key)) {
- MAKE_STD_ZVAL(prm);
- array_init_size(prm, 2);
-
- MAKE_STD_ZVAL(val);
- if (opts->defval) {
- ZVAL_COPY_VALUE(val, opts->defval);
- zval_copy_ctor(val);
+ if (Z_TYPE(key) == IS_ARRAY) {
+ merge_param(params, &key, &state->current.val, &state->current.args);
+ } else if (Z_TYPE(key) == IS_STRING && Z_STRLEN(key)) {
- //array_init_size(&prm, 2);
++ // FIXME: array_init_size(&prm, 2);
+ array_init(&prm);
+
+ if (!Z_ISUNDEF(opts->defval)) {
+ ZVAL_COPY_VALUE(&val, &opts->defval);
+ zval_copy_ctor(&val);
} else {
- ZVAL_TRUE(val);
+ ZVAL_TRUE(&val);
}
if (rfc5987 && (opts->flags & PHP_HTTP_PARAMS_RFC5987)) {
- zend_hash_update(Z_ARRVAL_P(prm), "*rfc5987*", sizeof("*rfc5987*"), (void *) &val, sizeof(zval *), (void *) &state->current.val);
+ state->current.val = zend_hash_str_update(Z_ARRVAL(prm), "*rfc5987*", lenof("*rfc5987*"), &val);
} else {
- zend_hash_update(Z_ARRVAL_P(prm), "value", sizeof("value"), (void *) &val, sizeof(zval *), (void *) &state->current.val);
+ state->current.val = zend_hash_str_update(Z_ARRVAL(prm), "value", lenof("value"), &val);
}
- //array_init_size(&arg, 3);
-
- MAKE_STD_ZVAL(arg);
- array_init_size(arg, 3);
- zend_hash_update(Z_ARRVAL_P(prm), "arguments", sizeof("arguments"), (void *) &arg, sizeof(zval *), (void *) &state->current.args);
-
- zend_symtable_update(params, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void *) &prm, sizeof(zval *), (void *) &state->current.param);
++ // FIXME: array_init_size(&arg, 3);
+ array_init(&arg);
+ state->current.args = zend_hash_str_update(Z_ARRVAL(prm), "arguments", lenof("arguments"), &arg);
+ state->current.param = zend_symtable_str_update(params, Z_STRVAL(key), Z_STRLEN(key), &prm);
}
zval_ptr_dtor(&key);
}
}
}
-static inline void shift_rfc5988(php_http_buffer_t *buf, char *key_str, size_t key_len, const char *ass, size_t asl, unsigned flags TSRMLS_DC)
++static inline void shift_rfc5988(php_http_buffer_t *buf, char *key_str, size_t key_len, const char *ass, size_t asl, unsigned flags)
+ {
+ char *str;
+ size_t len;
+
+ if (buf->used) {
+ php_http_buffer_append(buf, ass, asl);
+ }
+
- prepare_key(flags, key_str, key_len, &str, &len TSRMLS_CC);
++ prepare_key(flags, key_str, key_len, &str, &len);
+ php_http_buffer_appends(buf, "<");
+ php_http_buffer_append(buf, str, len);
+ php_http_buffer_appends(buf, ">");
+ efree(str);
+ }
+
-static inline void shift_rfc5988_val(php_http_buffer_t *buf, zval *zv, const char *vss, size_t vsl, unsigned flags TSRMLS_DC)
++static inline void shift_rfc5988_val(php_http_buffer_t *buf, zval *zv, const char *vss, size_t vsl, unsigned flags)
+ {
- zval *tmp = php_http_zsep(1, IS_STRING, zv);
++ zend_string *zs = zval_get_string(zv);
+
- quote_string(tmp, 1 TSRMLS_CC);
++ quote_string(&zs, 1);
+ php_http_buffer_append(buf, vss, vsl);
- php_http_buffer_append(buf, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
++ php_http_buffer_append(buf, zs->val, zs->len);
+
- zval_ptr_dtor(&tmp);
++ zend_string_release(zs);
+ }
+
-static inline void shift_val(php_http_buffer_t *buf, zval *zvalue, const char *vss, size_t vsl, unsigned flags TSRMLS_DC)
+static inline void shift_val(php_http_buffer_t *buf, zval *zvalue, const char *vss, size_t vsl, unsigned flags)
{
- if (Z_TYPE_P(zvalue) != IS_BOOL) {
- zval *tmp = php_http_zsep(1, IS_STRING, zvalue);
+ zval tmp;
+ zend_string *zs;
- prepare_value(flags, tmp TSRMLS_CC);
- php_http_buffer_append(buf, vss, vsl);
- php_http_buffer_append(buf, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
+ switch (Z_TYPE_P(zvalue)) {
+ case IS_TRUE:
+ break;
- zval_ptr_dtor(&tmp);
- } else if (!Z_BVAL_P(zvalue)) {
+ case IS_FALSE:
php_http_buffer_append(buf, vss, vsl);
php_http_buffer_appends(buf, "0");
+ break;
+
+ default:
+ zs = zval_get_string(zvalue);
+
+ ZVAL_STR(&tmp, zs);
+ prepare_value(flags, &tmp);
+ php_http_buffer_append(buf, vss, vsl);
+ php_http_buffer_append(buf, Z_STRVAL(tmp), Z_STRLEN(tmp));
+
+ zval_ptr_dtor(&tmp);
+ break;
}
}
zend_bool rfc5987 = !strcmp(key_str, "*rfc5987*");
if (!rfc5987) {
- shift_key(buf, key_str, key_len, ass, asl, flags TSRMLS_CC);
+ shift_key(buf, key_str, key_len, ass, asl, flags);
}
- FOREACH_KEYVAL(pos, zvalue, key, val) {
+ ZEND_HASH_FOREACH_KEY_VAL_IND(ht, key.h, key.key, val)
+ {
/* did you mean recursion? */
- php_http_array_hashkey_stringify(&key);
- if (rfc5987 && (Z_TYPE_PP(val) == IS_ARRAY || Z_TYPE_PP(val) == IS_OBJECT)) {
- shift_key(buf, key.str, key.len-1, ass, asl, flags TSRMLS_CC);
- shift_rfc5987(buf, *val, vss, vsl, flags TSRMLS_CC);
+ php_http_arrkey_stringify(&key, NULL);
+ if (rfc5987 && (Z_TYPE_P(val) == IS_ARRAY || Z_TYPE_P(val) == IS_OBJECT)) {
+ shift_key(buf, key.key->val, key.key->len, ass, asl, flags);
+ shift_rfc5987(buf, val, vss, vsl, flags);
} else {
- shift_arg(buf, key.str, key.len-1, *val, ass, asl, vss, vsl, flags TSRMLS_CC);
+ shift_arg(buf, key.key->val, key.key->len, val, ass, asl, vss, vsl, flags);
}
- php_http_array_hashkey_stringfree(&key);
+ php_http_arrkey_dtor(&key);
}
+ ZEND_HASH_FOREACH_END();
} else {
- shift_key(buf, key_str, key_len, ass, asl, flags TSRMLS_CC);
+ shift_key(buf, key_str, key_len, ass, asl, flags);
+
+ if (flags & PHP_HTTP_PARAMS_RFC5988) {
+ switch (key_len) {
+ case lenof("rel"):
+ case lenof("title"):
+ case lenof("anchor"):
+ /* some args must be quoted */
+ if (0 <= php_http_select_str(key_str, 3, "rel", "title", "anchor")) {
- shift_rfc5988_val(buf, zvalue, vss, vsl, flags TSRMLS_CC);
++ shift_rfc5988_val(buf, zvalue, vss, vsl, flags);
+ return;
+ }
+ break;
+ }
+ }
+
- shift_val(buf, zvalue, vss, vsl, flags TSRMLS_CC);
+ shift_val(buf, zvalue, vss, vsl, flags);
}
}
/* treat as arguments, unless we care for dimensions or rfc5987 */
if (flags & PHP_HTTP_PARAMS_DIMENSION) {
php_http_buffer_t *keybuf = php_http_buffer_from_string(key_str, key_len);
- prepare_dimension(buf, keybuf, zvalue, pss, psl, vss, vsl, flags TSRMLS_CC);
+ prepare_dimension(buf, keybuf, zvalue, pss, psl, vss, vsl, flags);
php_http_buffer_free(&keybuf);
} else if (rfc5987) {
- shift_key(buf, key_str, key_len, pss, psl, flags TSRMLS_CC);
- shift_rfc5987(buf, zvalue, vss, vsl, flags TSRMLS_CC);
+ shift_key(buf, key_str, key_len, pss, psl, flags);
+ shift_rfc5987(buf, zvalue, vss, vsl, flags);
} else {
- shift_arg(buf, key_str, key_len, zvalue, ass, asl, vss, vsl, flags TSRMLS_CC);
+ shift_arg(buf, key_str, key_len, zvalue, ass, asl, vss, vsl, flags);
}
} else {
- shift_rfc5988(buf, key_str, key_len, pss, psl, flags TSRMLS_CC);
+ shift_key(buf, key_str, key_len, pss, psl, flags);
+ if (flags & PHP_HTTP_PARAMS_RFC5988) {
- shift_key(buf, key_str, key_len, pss, psl, flags TSRMLS_CC);
++ shift_rfc5988(buf, key_str, key_len, pss, psl, flags);
+ } else {
- shift_val(buf, zvalue, vss, vsl, flags TSRMLS_CC);
++ shift_key(buf, key_str, key_len, pss, psl, flags);
+ }
+ shift_val(buf, zvalue, vss, vsl, flags);
}
}
zend_class_entry ce = {0};
INIT_NS_CLASS_ENTRY(ce, "http", "Params", php_http_params_methods);
- php_http_params_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
+ php_http_params_class_entry = zend_register_internal_class(&ce);
php_http_params_class_entry->create_object = php_http_params_object_new;
- zend_class_implements(php_http_params_class_entry TSRMLS_CC, 1, zend_ce_arrayaccess);
-
- zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("DEF_PARAM_SEP"), ZEND_STRL(",") TSRMLS_CC);
- zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("DEF_ARG_SEP"), ZEND_STRL(";") TSRMLS_CC);
- zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("DEF_VAL_SEP"), ZEND_STRL("=") TSRMLS_CC);
- zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("COOKIE_PARAM_SEP"), ZEND_STRL("") TSRMLS_CC);
-
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_RAW"), PHP_HTTP_PARAMS_RAW TSRMLS_CC);
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_ESCAPED"), PHP_HTTP_PARAMS_ESCAPED TSRMLS_CC);
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_URLENCODED"), PHP_HTTP_PARAMS_URLENCODED TSRMLS_CC);
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_DIMENSION"), PHP_HTTP_PARAMS_DIMENSION TSRMLS_CC);
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_RFC5987"), PHP_HTTP_PARAMS_RFC5987 TSRMLS_CC);
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_RFC5988"), PHP_HTTP_PARAMS_RFC5988 TSRMLS_CC);
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_DEFAULT"), PHP_HTTP_PARAMS_DEFAULT TSRMLS_CC);
- zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_QUERY"), PHP_HTTP_PARAMS_QUERY TSRMLS_CC);
-
- zend_declare_property_null(php_http_params_class_entry, ZEND_STRL("params"), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_stringl(php_http_params_class_entry, ZEND_STRL("param_sep"), ZEND_STRL(","), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_stringl(php_http_params_class_entry, ZEND_STRL("arg_sep"), ZEND_STRL(";"), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_stringl(php_http_params_class_entry, ZEND_STRL("val_sep"), ZEND_STRL("="), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_long(php_http_params_class_entry, ZEND_STRL("flags"), PHP_HTTP_PARAMS_DEFAULT, ZEND_ACC_PUBLIC TSRMLS_CC);
+ zend_class_implements(php_http_params_class_entry, 1, zend_ce_arrayaccess);
+
+ zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("DEF_PARAM_SEP"), ZEND_STRL(","));
+ zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("DEF_ARG_SEP"), ZEND_STRL(";"));
+ zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("DEF_VAL_SEP"), ZEND_STRL("="));
+ zend_declare_class_constant_stringl(php_http_params_class_entry, ZEND_STRL("COOKIE_PARAM_SEP"), ZEND_STRL(""));
+
+ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_RAW"), PHP_HTTP_PARAMS_RAW);
+ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_ESCAPED"), PHP_HTTP_PARAMS_ESCAPED);
+ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_URLENCODED"), PHP_HTTP_PARAMS_URLENCODED);
+ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_DIMENSION"), PHP_HTTP_PARAMS_DIMENSION);
+ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_RFC5987"), PHP_HTTP_PARAMS_RFC5987);
++ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_RFC5988"), PHP_HTTP_PARAMS_RFC5988);
+ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_DEFAULT"), PHP_HTTP_PARAMS_DEFAULT);
+ zend_declare_class_constant_long(php_http_params_class_entry, ZEND_STRL("PARSE_QUERY"), PHP_HTTP_PARAMS_QUERY);
+
+ zend_declare_property_null(php_http_params_class_entry, ZEND_STRL("params"), ZEND_ACC_PUBLIC);
+ zend_declare_property_stringl(php_http_params_class_entry, ZEND_STRL("param_sep"), ZEND_STRL(","), ZEND_ACC_PUBLIC);
+ zend_declare_property_stringl(php_http_params_class_entry, ZEND_STRL("arg_sep"), ZEND_STRL(";"), ZEND_ACC_PUBLIC);
+ zend_declare_property_stringl(php_http_params_class_entry, ZEND_STRL("val_sep"), ZEND_STRL("="), ZEND_ACC_PUBLIC);
+ zend_declare_property_long(php_http_params_class_entry, ZEND_STRL("flags"), PHP_HTTP_PARAMS_DEFAULT, ZEND_ACC_PUBLIC);
return SUCCESS;
}
}
}
- return Z_ARRVAL(arr);
+ return ht;
}
-ZEND_RESULT_CODE php_http_url_encode_hash(HashTable *hash, const char *pre_encoded_str, size_t pre_encoded_len, char **encoded_str, size_t *encoded_len TSRMLS_DC)
+ZEND_RESULT_CODE php_http_url_encode_hash(HashTable *hash, const char *pre_encoded_str, size_t pre_encoded_len, char **encoded_str, size_t *encoded_len)
{
- const char *arg_sep_str;
- size_t arg_sep_len;
+ const char *arg_sep_str = "&";
+ size_t arg_sep_len = 1;
php_http_buffer_t *qstr = php_http_buffer_new();
- php_http_url_argsep(&arg_sep_str, &arg_sep_len TSRMLS_CC);
+ php_http_url_argsep(&arg_sep_str, &arg_sep_len);
- if (SUCCESS != php_http_url_encode_hash_ex(hash, qstr, arg_sep_str, arg_sep_len, "=", 1, pre_encoded_str, pre_encoded_len TSRMLS_CC)) {
+ if (SUCCESS != php_http_url_encode_hash_ex(hash, qstr, arg_sep_str, arg_sep_len, "=", 1, pre_encoded_str, pre_encoded_len)) {
php_http_buffer_free(&qstr);
return FAILURE;
}
PHP_METHOD(HttpUrl, mod)
{
zval *new_url = NULL;
- zend_long flags = PHP_HTTP_URL_JOIN_PATH | PHP_HTTP_URL_JOIN_QUERY;
- long flags = PHP_HTTP_URL_JOIN_PATH | PHP_HTTP_URL_JOIN_QUERY | PHP_HTTP_URL_SANITIZE_PATH;
++ zend_long flags = PHP_HTTP_URL_JOIN_PATH | PHP_HTTP_URL_JOIN_QUERY | PHP_HTTP_URL_SANITIZE_PATH;
zend_error_handling zeh;
- php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!|l", &new_url, &flags), invalid_arg, return);
+ php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "z!|l", &new_url, &flags), invalid_arg, return);
- zend_replace_error_handling(EH_THROW, php_http_exception_bad_url_class_entry, &zeh TSRMLS_CC);
+ zend_replace_error_handling(EH_THROW, php_http_exception_bad_url_class_entry, &zeh);
{
php_http_url_t *new_purl = NULL, *old_purl = NULL;
zend_class_entry ce = {0};
INIT_NS_CLASS_ENTRY(ce, "http", "Url", php_http_url_methods);
- php_http_url_class_entry = zend_register_internal_class(&ce TSRMLS_CC);
-
- zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("scheme"), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("user"), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("pass"), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("host"), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("port"), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("path"), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("query"), ZEND_ACC_PUBLIC TSRMLS_CC);
- zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("fragment"), ZEND_ACC_PUBLIC TSRMLS_CC);
-
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("REPLACE"), PHP_HTTP_URL_REPLACE TSRMLS_CC);
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("JOIN_PATH"), PHP_HTTP_URL_JOIN_PATH TSRMLS_CC);
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("JOIN_QUERY"), PHP_HTTP_URL_JOIN_QUERY TSRMLS_CC);
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_USER"), PHP_HTTP_URL_STRIP_USER TSRMLS_CC);
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_PASS"), PHP_HTTP_URL_STRIP_PASS TSRMLS_CC);
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_AUTH"), PHP_HTTP_URL_STRIP_AUTH TSRMLS_CC);
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_PORT"), PHP_HTTP_URL_STRIP_PORT TSRMLS_CC);
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_PATH"), PHP_HTTP_URL_STRIP_PATH TSRMLS_CC);
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_QUERY"), PHP_HTTP_URL_STRIP_QUERY TSRMLS_CC);
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_FRAGMENT"), PHP_HTTP_URL_STRIP_FRAGMENT TSRMLS_CC);
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_ALL"), PHP_HTTP_URL_STRIP_ALL TSRMLS_CC);
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("FROM_ENV"), PHP_HTTP_URL_FROM_ENV TSRMLS_CC);
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("SANITIZE_PATH"), PHP_HTTP_URL_SANITIZE_PATH TSRMLS_CC);
+ php_http_url_class_entry = zend_register_internal_class(&ce);
+
+ zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("scheme"), ZEND_ACC_PUBLIC);
+ zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("user"), ZEND_ACC_PUBLIC);
+ zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("pass"), ZEND_ACC_PUBLIC);
+ zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("host"), ZEND_ACC_PUBLIC);
+ zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("port"), ZEND_ACC_PUBLIC);
+ zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("path"), ZEND_ACC_PUBLIC);
+ zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("query"), ZEND_ACC_PUBLIC);
+ zend_declare_property_null(php_http_url_class_entry, ZEND_STRL("fragment"), ZEND_ACC_PUBLIC);
+
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("REPLACE"), PHP_HTTP_URL_REPLACE);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("JOIN_PATH"), PHP_HTTP_URL_JOIN_PATH);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("JOIN_QUERY"), PHP_HTTP_URL_JOIN_QUERY);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_USER"), PHP_HTTP_URL_STRIP_USER);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_PASS"), PHP_HTTP_URL_STRIP_PASS);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_AUTH"), PHP_HTTP_URL_STRIP_AUTH);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_PORT"), PHP_HTTP_URL_STRIP_PORT);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_PATH"), PHP_HTTP_URL_STRIP_PATH);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_QUERY"), PHP_HTTP_URL_STRIP_QUERY);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_FRAGMENT"), PHP_HTTP_URL_STRIP_FRAGMENT);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("STRIP_ALL"), PHP_HTTP_URL_STRIP_ALL);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("FROM_ENV"), PHP_HTTP_URL_FROM_ENV);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("SANITIZE_PATH"), PHP_HTTP_URL_SANITIZE_PATH);
#ifdef PHP_HTTP_HAVE_WCHAR
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_MBLOC"), PHP_HTTP_URL_PARSE_MBLOC TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_MBLOC"), PHP_HTTP_URL_PARSE_MBLOC);
#endif
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_MBUTF8"), PHP_HTTP_URL_PARSE_MBUTF8 TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_MBUTF8"), PHP_HTTP_URL_PARSE_MBUTF8);
- #if defined(PHP_HTTP_HAVE_IDN) || defined(HAVE_UIDNA_IDNTOASCII)
+ #if defined(PHP_HTTP_HAVE_IDN2) || defined(PHP_HTTP_HAVE_IDN) || defined(HAVE_UIDNA_IDNTOASCII)
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_TOIDN"), PHP_HTTP_URL_PARSE_TOIDN TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_TOIDN"), PHP_HTTP_URL_PARSE_TOIDN);
#endif
- zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_TOPCT"), PHP_HTTP_URL_PARSE_TOPCT TSRMLS_CC);
+ zend_declare_class_constant_long(php_http_url_class_entry, ZEND_STRL("PARSE_TOPCT"), PHP_HTTP_URL_PARSE_TOPCT);
return SUCCESS;
}