while ((got = php_http_buffer_chunk_buffer(s, data, data_len, &chunk, chunk_len))) {
if (PHP_HTTP_BUFFER_PASS0 == passout(opaque, chunk, got TSRMLS_CC)) {
- STR_SET(chunk, NULL);
+ PTR_SET(chunk, NULL);
return PHP_HTTP_BUFFER_PASS0;
}
++passed;
}
data = NULL;
data_len = 0;
- STR_SET(chunk, NULL);
+ PTR_SET(chunk, NULL);
}
- STR_FREE(chunk);
+ PTR_FREE(chunk);
return passed;
}
#define PHP_HTTP_BUFFER_NOMEM PHP_HTTP_BUFFER_ERROR
#define PHP_HTTP_BUFFER_PASS0 PHP_HTTP_BUFFER_ERROR
-#ifndef STR_FREE
-# define STR_FREE(STR) \
+#ifndef PTR_FREE
+# define PTR_FREE(PTR) \
{ \
- if (STR) { \
- efree(STR); \
+ if (PTR) { \
+ efree(PTR); \
} \
}
#endif
-#ifndef STR_SET
-# define STR_SET(STR, SET) \
+#ifndef PTR_SET
+# define PTR_SET(PTR, SET) \
{ \
- STR_FREE(STR); \
- STR = SET; \
+ PTR_FREE(PTR); \
+ PTR = SET; \
}
#endif
#ifndef TSRMLS_D
php_http_url_free(&old_url);
}
if (new_url.query != &empty[0]) {
- STR_FREE(new_url.query);
+ PTR_FREE(new_url.query);
}
RETVAL_ZVAL(getThis(), 1, 0);
if (old_url) {
php_http_url_free(&old_url);
}
- STR_FREE(new_url.query);
+ PTR_FREE(new_url.query);
RETVAL_ZVAL(getThis(), 1, 0);
}
array_copy(&from->cookies, &to->cookies);
array_copy(&from->extras, &to->extras);
- STR_SET(to->path, from->path ? estrdup(from->path) : NULL);
- STR_SET(to->domain, from->domain ? estrdup(from->domain) : NULL);
+ PTR_SET(to->path, from->path ? estrdup(from->path) : NULL);
+ PTR_SET(to->domain, from->domain ? estrdup(from->domain) : NULL);
to->expires = from->expires;
to->max_age = from->max_age;
to->flags = from->flags;
zend_hash_destroy(&list->cookies);
zend_hash_destroy(&list->extras);
- STR_SET(list->path, NULL);
- STR_SET(list->domain, NULL);
+ PTR_SET(list->path, NULL);
+ PTR_SET(list->domain, NULL);
}
}
}
if _KEY_IS("path") {
- STR_SET(list->path, estrndup(Z_STRVAL_P(arg), Z_STRLEN_P(arg)));
+ PTR_SET(list->path, estrndup(Z_STRVAL_P(arg), Z_STRLEN_P(arg)));
} else if _KEY_IS("domain") {
- STR_SET(list->domain, estrndup(Z_STRVAL_P(arg), Z_STRLEN_P(arg)));
+ PTR_SET(list->domain, estrndup(Z_STRVAL_P(arg), Z_STRLEN_P(arg)));
} else if _KEY_IS("expires") {
char *date = estrndup(Z_STRVAL_P(arg), Z_STRLEN_P(arg));
list->expires = php_parse_date(date, NULL);
PHP_HTTP_COOKIE_OBJECT_INIT(obj);
- STR_SET(obj->list->domain, domain_str ? estrndup(domain_str, domain_len) : NULL);
+ PTR_SET(obj->list->domain, domain_str ? estrndup(domain_str, domain_len) : NULL);
RETVAL_ZVAL(getThis(), 1, 0);
}
PHP_HTTP_COOKIE_OBJECT_INIT(obj);
- STR_SET(obj->list->path, path_str ? estrndup(path_str, path_len) : NULL);
+ PTR_SET(obj->list->path, path_str ? estrndup(path_str, path_len) : NULL);
RETVAL_ZVAL(getThis(), 1, 0);
}
(*encoded)[*encoded_len = Z.total_out] = '\0';
return SUCCESS;
} else {
- STR_SET(*encoded, NULL);
+ PTR_SET(*encoded, NULL);
*encoded_len = 0;
}
}
return SUCCESS;
}
- STR_SET(*encoded, NULL);
+ PTR_SET(*encoded, NULL);
*encoded_len = 0;
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to update deflate stream: %s", zError(status));
return FAILURE;
return SUCCESS;
}
- STR_SET(*encoded, NULL);
+ PTR_SET(*encoded, NULL);
*encoded_len = 0;
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to flush deflate stream: %s", zError(status));
return FAILURE;
return SUCCESS;
}
- STR_SET(*encoded, NULL);
+ PTR_SET(*encoded, NULL);
*encoded_len = 0;
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to finish deflate stream: %s", zError(status));
return FAILURE;
return SUCCESS;
}
- STR_SET(*decoded, NULL);
+ PTR_SET(*decoded, NULL);
*decoded_len = 0;
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to finish inflate stream: %s", zError(status));
return FAILURE;
RETURN_EMPTY_STRING();
}
} else {
- STR_FREE(encoded_str);
+ PTR_FREE(encoded_str);
}
}
}
}
}
- STR_SET(SG(request_info).content_type_dup, NULL);
+ PTR_SET(SG(request_info).content_type_dup, NULL);
return SUCCESS;
}
return PHP_HTTP_RANGE_NO;
}
if (strncmp(range, "bytes=", lenof("bytes="))) {
- STR_FREE(range);
+ PTR_FREE(range);
return PHP_HTTP_RANGE_NO;
}
switch (end) {
/* "0-" */
case -1:
- STR_FREE(range);
+ PTR_FREE(range);
return PHP_HTTP_RANGE_NO;
/* "0-0" */
case -1:
/* "-", "-0" */
if (end == -1 || end == -10) {
- STR_FREE(range);
+ PTR_FREE(range);
return PHP_HTTP_RANGE_ERR;
}
begin = length - end;
/* "12345-(NNN)" */
default:
if (length <= (size_t) begin) {
- STR_FREE(range);
+ PTR_FREE(range);
return PHP_HTTP_RANGE_ERR;
}
switch (end) {
/* "12345-0" */
case -10:
- STR_FREE(range);
+ PTR_FREE(range);
return PHP_HTTP_RANGE_ERR;
/* "12345-" */
if (length <= (size_t) end) {
end = length - 1;
} else if (end < begin) {
- STR_FREE(range);
+ PTR_FREE(range);
return PHP_HTTP_RANGE_ERR;
}
break;
break;
default:
- STR_FREE(range);
+ PTR_FREE(range);
return PHP_HTTP_RANGE_NO;
}
} while (c != 0);
- STR_FREE(range);
+ PTR_FREE(range);
return PHP_HTTP_RANGE_OK;
}
ret = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, (void *) &h TSRMLS_CC);
zval_ptr_dtor(&data);
- STR_FREE(h.line);
+ PTR_FREE(h.line);
return ret;
}
}
}
#if PHP_VERSION_ID >= 50600
- STR_FREE(json_str);
+ PTR_FREE(json_str);
#endif
}
efree(etag);
}
- STR_FREE(header);
+ PTR_FREE(header);
return ret;
}
}
}
- STR_FREE(header);
+ PTR_FREE(header);
return ret;
}
return SUCCESS;
}
chunks_sent = php_http_buffer_chunked_output(&r->buffer, enc_str, enc_len, buf ? chunk : 0, output, r TSRMLS_CC);
- STR_FREE(enc_str);
+ PTR_FREE(enc_str);
} else {
chunks_sent = php_http_buffer_chunked_output(&r->buffer, buf, len, buf ? chunk : 0, output, r TSRMLS_CC);
}
}
php_http_buffer_free(&r->buffer);
zval_ptr_dtor(&r->options);
- STR_FREE(r->content.type);
- STR_FREE(r->content.encoding);
+ PTR_FREE(r->content.type);
+ PTR_FREE(r->content.encoding);
if (r->content.encoder) {
php_http_encoding_stream_free(&r->content.encoder);
}
{
zend_ptr_stack_destroy(&parser->stack);
php_http_info_dtor(&parser->info);
- STR_FREE(parser->_key.str);
- STR_FREE(parser->_val.str);
+ PTR_FREE(parser->_key.str);
+ PTR_FREE(parser->_val.str);
}
void php_http_header_parser_free(php_http_header_parser_t **parser)
parser->_val.str = NULL;
}
- STR_SET(parser->_key.str, NULL);
- STR_SET(parser->_val.str, NULL);
+ PTR_SET(parser->_key.str, NULL);
+ PTR_SET(parser->_val.str, NULL);
php_http_header_parser_state_push(parser, 1, PHP_HTTP_HEADER_PARSER_STATE_KEY);
break;
{
switch (i->type) {
case PHP_HTTP_REQUEST:
- STR_SET(PHP_HTTP_INFO(i).request.method, NULL);
- STR_SET(PHP_HTTP_INFO(i).request.url, NULL);
+ PTR_SET(PHP_HTTP_INFO(i).request.method, NULL);
+ PTR_SET(PHP_HTTP_INFO(i).request.url, NULL);
break;
case PHP_HTTP_RESPONSE:
- STR_SET(PHP_HTTP_INFO(i).response.status, NULL);
+ PTR_SET(PHP_HTTP_INFO(i).response.status, NULL);
break;
default:
if (http > url) {
PHP_HTTP_INFO(info).request.url = php_http_url_parse(url, http - url, ~0 TSRMLS_CC);
} else {
- STR_SET(PHP_HTTP_INFO(info).request.method, NULL);
+ PTR_SET(PHP_HTTP_INFO(info).request.method, NULL);
return NULL;
}
} else {
/* free request info */
switch (message->type) {
case PHP_HTTP_REQUEST:
- STR_FREE(message->http.info.request.method);
- STR_FREE(message->http.info.request.url);
+ PTR_FREE(message->http.info.request.method);
+ PTR_FREE(message->http.info.request.url);
break;
case PHP_HTTP_RESPONSE:
- STR_FREE(message->http.info.response.status);
+ PTR_FREE(message->http.info.response.status);
break;
default:
message->http.version = info->http.version;
switch (message->type) {
case PHP_HTTP_REQUEST:
- STR_SET(PHP_HTTP_INFO(message).request.url, PHP_HTTP_INFO(info).request.url ? php_http_url_copy(PHP_HTTP_INFO(info).request.url, 0) : NULL);
- STR_SET(PHP_HTTP_INFO(message).request.method, PHP_HTTP_INFO(info).request.method ? estrdup(PHP_HTTP_INFO(info).request.method) : NULL);
+ PTR_SET(PHP_HTTP_INFO(message).request.url, PHP_HTTP_INFO(info).request.url ? php_http_url_copy(PHP_HTTP_INFO(info).request.url, 0) : NULL);
+ PTR_SET(PHP_HTTP_INFO(message).request.method, PHP_HTTP_INFO(info).request.method ? estrdup(PHP_HTTP_INFO(info).request.method) : NULL);
break;
case PHP_HTTP_RESPONSE:
PHP_HTTP_INFO(message).response.code = PHP_HTTP_INFO(info).response.code;
- STR_SET(PHP_HTTP_INFO(message).response.status, PHP_HTTP_INFO(info).response.status ? estrdup(PHP_HTTP_INFO(info).response.status) : NULL);
+ PTR_SET(PHP_HTTP_INFO(message).response.status, PHP_HTTP_INFO(info).response.status ? estrdup(PHP_HTTP_INFO(info).response.status) : NULL);
break;
default:
switch (msg->type) {
case PHP_HTTP_REQUEST:
php_http_buffer_appendf(str, PHP_HTTP_INFO_REQUEST_FMT_ARGS(&msg->http, tmp, PHP_HTTP_CRLF));
- STR_FREE(tmp);
+ PTR_FREE(tmp);
break;
case PHP_HTTP_RESPONSE:
php_http_buffer_appendf(str, PHP_HTTP_INFO_RESPONSE_FMT_ARGS(&msg->http, tmp, PHP_HTTP_CRLF));
- STR_FREE(tmp);
+ PTR_FREE(tmp);
break;
default:
switch (message->type) {
case PHP_HTTP_REQUEST:
- STR_SET(message->http.info.request.method, NULL);
- STR_SET(message->http.info.request.url, NULL);
+ PTR_SET(message->http.info.request.method, NULL);
+ PTR_SET(message->http.info.request.url, NULL);
break;
case PHP_HTTP_RESPONSE:
- STR_SET(message->http.info.response.status, NULL);
+ PTR_SET(message->http.info.response.status, NULL);
break;
default:
static void php_http_message_object_prophandler_set_request_method(php_http_message_object_t *obj, zval *value TSRMLS_DC) {
if (PHP_HTTP_MESSAGE_TYPE(REQUEST, obj->message)) {
zval *cpy = php_http_ztyp(IS_STRING, value);
- STR_SET(obj->message->http.info.request.method, estrndup(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy)));
+ PTR_SET(obj->message->http.info.request.method, estrndup(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy)));
zval_ptr_dtor(&cpy);
}
}
}
static void php_http_message_object_prophandler_set_request_url(php_http_message_object_t *obj, zval *value TSRMLS_DC) {
if (PHP_HTTP_MESSAGE_TYPE(REQUEST, obj->message)) {
- STR_SET(obj->message->http.info.request.url, php_http_url_from_zval(value, ~0 TSRMLS_CC));
+ PTR_SET(obj->message->http.info.request.url, php_http_url_from_zval(value, ~0 TSRMLS_CC));
}
}
static void php_http_message_object_prophandler_get_response_status(php_http_message_object_t *obj, zval *return_value TSRMLS_DC) {
static void php_http_message_object_prophandler_set_response_status(php_http_message_object_t *obj, zval *value TSRMLS_DC) {
if (PHP_HTTP_MESSAGE_TYPE(RESPONSE, obj->message)) {
zval *cpy = php_http_ztyp(IS_STRING, value);
- STR_SET(obj->message->http.info.response.status, estrndup(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy)));
+ PTR_SET(obj->message->http.info.response.status, estrndup(Z_STRVAL_P(cpy), Z_STRLEN_P(cpy)));
zval_ptr_dtor(&cpy);
}
}
if (PHP_HTTP_MESSAGE_TYPE(RESPONSE, obj->message)) {
zval *cpy = php_http_ztyp(IS_LONG, value);
obj->message->http.info.response.code = Z_LVAL_P(cpy);
- STR_SET(obj->message->http.info.response.status, estrdup(php_http_env_get_response_status_for_code(obj->message->http.info.response.code)));
+ PTR_SET(obj->message->http.info.response.status, estrdup(php_http_env_get_response_status_for_code(obj->message->http.info.response.code)));
zval_ptr_dtor(&cpy);
}
}
switch (obj->message->type) {
case PHP_HTTP_REQUEST:
Z_STRLEN_P(return_value) = spprintf(&Z_STRVAL_P(return_value), 0, PHP_HTTP_INFO_REQUEST_FMT_ARGS(&obj->message->http, tmp, ""));
- STR_FREE(tmp);
+ PTR_FREE(tmp);
break;
case PHP_HTTP_RESPONSE:
Z_STRLEN_P(return_value) = spprintf(&Z_STRVAL_P(return_value), 0, PHP_HTTP_INFO_RESPONSE_FMT_ARGS(&obj->message->http, tmp, ""));
- STR_FREE(tmp);
+ PTR_FREE(tmp);
break;
default:
RETURN_NULL();
}
obj->message->http.info.response.code = code;
- STR_SET(obj->message->http.info.response.status, estrdup(php_http_env_get_response_status_for_code(code)));
+ PTR_SET(obj->message->http.info.response.status, estrdup(php_http_env_get_response_status_for_code(code)));
RETVAL_ZVAL(getThis(), 1, 0);
}
php_http_throw(bad_method_call, "http\\Message is not of type response", NULL);
}
- STR_SET(obj->message->http.info.response.status, estrndup(status, status_len));
+ PTR_SET(obj->message->http.info.response.status, estrndup(status, status_len));
RETVAL_ZVAL(getThis(), 1, 0);
}
return;
}
- STR_SET(obj->message->http.info.request.method, estrndup(method, method_len));
+ PTR_SET(obj->message->http.info.request.method, estrndup(method, method_len));
RETVAL_ZVAL(getThis(), 1, 0);
}
php_http_url_free(&url);
php_http_throw(invalid_arg, "Cannot set http\\Message's request url to an empty string", NULL);
} else {
- STR_SET(obj->message->http.info.request.url, url);
+ PTR_SET(obj->message->http.info.request.url, url);
}
RETVAL_ZVAL(getThis(), 1, 0);
php_http_expect(msg = php_http_message_body_split(obj->message->body, boundary), bad_message, return);
- STR_FREE(boundary);
+ PTR_FREE(boundary);
RETURN_OBJVAL(php_http_message_object_new_ex(php_http_message_class_entry, msg, NULL TSRMLS_CC), 0);
}
TSRMLS_FETCH_FROM_CTX(body->ts);
/* NOFIXME: shows leakinfo in DEBUG mode */
zend_list_delete(body->stream_id);
- STR_FREE(body->boundary);
+ PTR_FREE(body->boundary);
efree(body);
}
*body_ptr = NULL;
php_http_buffer_free(&tmp);
php_http_message_parser_free(&arg.parser);
php_http_buffer_dtor(&arg.buf);
- STR_FREE(arg.boundary_str);
+ PTR_FREE(arg.boundary_str);
return msg;
}
}
if (str != buffer->data) {
- STR_FREE(str);
+ PTR_FREE(str);
}
str = dec_str;
len = dec_len;
}
if (str != buffer->data) {
- STR_FREE(str);
+ PTR_FREE(str);
}
str = NULL;
}
}
- STR_FREE(haystack);
- STR_FREE(needle);
+ PTR_FREE(haystack);
+ PTR_FREE(needle);
}
return result;
/* STRING UTILITIES */
-#ifndef STR_SET
-# define STR_SET(STR, SET) \
+#ifndef PTR_SET
+# define PTR_SET(STR, SET) \
{ \
- STR_FREE(STR); \
+ PTR_FREE(STR); \
STR = SET; \
}
#endif
static inline void php_http_array_hashkey_stringfree(php_http_array_hashkey_t *key)
{
if (key->type != HASH_KEY_IS_STRING || key->dup) {
- STR_FREE(key->str);
+ PTR_FREE(key->str);
}
}
add_index_double(&arr, key.num, q);
}
- STR_FREE(key.str);
+ PTR_FREE(key.str);
}
#if 0
if (value) {
result = php_http_negotiate(value, length, supported, "-", 1 TSRMLS_CC);
}
- STR_FREE(value);
+ PTR_FREE(value);
return result;
}
if (value) {
result = php_http_negotiate(value, length, supported, NULL, 0 TSRMLS_CC);
}
- STR_FREE(value);
+ PTR_FREE(value);
return result;
}
if (value) {
result = php_http_negotiate(value, length, supported, NULL, 0 TSRMLS_CC);
}
- STR_FREE(value);
+ PTR_FREE(value);
return result;
}
if (value) {
result = php_http_negotiate(value, length, supported, "/", 1 TSRMLS_CC);
}
- STR_FREE(value);
+ PTR_FREE(value);
return result;
}
ZVAL_COPY_VALUE(tmp, zv);
array_init(zv);
add_assoc_zval(zv, language, tmp);
- STR_FREE(language);
+ PTR_FREE(language);
}
}
php_http_params_token_t **sep = separator;
if (sep) {
while (*sep) {
- STR_FREE((*sep)->str);
+ PTR_FREE((*sep)->str);
efree(*sep);
++sep;
}
} else {
const char *path = NULL;
- url(buf)->path = &buf.data[buf.used];
-
if (url_isset(new_url, path)) {
path = new_url->path;
} else if (url_isset(old_url, path)) {
path = old_url->path;
- } else {
- php_http_buffer_append(&buf, "/", sizeof("/"));
}
if (path) {
- if (path[0] != '/') {
- php_http_buffer_append(&buf, "/", 1);
- }
+ url(buf)->path = &buf.data[buf.used];
+
php_http_buffer_append(&buf, path, strlen(path) + 1);
}
php_http_url_free(&tmp_url);
}
- /* set some sane defaults */
-
- if (!url(buf)->scheme) {
- url(buf)->scheme = &buf.data[buf.used];
- php_http_buffer_append(&buf, "http", sizeof("http"));
- }
-
- if (!url(buf)->host) {
- url(buf)->host = &buf.data[buf.used];
- php_http_buffer_append(&buf, "localhost", sizeof("localhost"));
- }
-
- if (!url(buf)->path) {
- url(buf)->path = &buf.data[buf.used];
- php_http_buffer_append(&buf, "/", sizeof("/"));
- }
/* replace directory references if path is not a single slash */
if ((flags & PHP_HTTP_URL_SANITIZE_PATH)
&& url(buf)->path[0] && url(buf)->path[1]) {
if (url->host && *url->host) {
php_http_buffer_appendl(&buf, url->host);
- }
-
- if (url->port) {
- php_http_buffer_appendf(&buf, ":%hu", url->port);
+ if (url->port) {
+ php_http_buffer_appendf(&buf, ":%hu", url->port);
+ }
}
if (url->path && *url->path) {
+ if (*url->path != '/') {
+ php_http_buffer_appends(&buf, "/");
+ }
php_http_buffer_appendl(&buf, url->path);
+ } else if (buf.used) {
+ php_http_buffer_appends(&buf, "/");
}
if (url->query && *url->query) {
php_http_url_free(&purl);
}
-ZEND_BEGIN_ARG_INFO_EX(ai_HttpUrl_parse, 0, 0, 1)
- ZEND_ARG_INFO(0, url)
- ZEND_ARG_INFO(0, flags)
-ZEND_END_ARG_INFO();
-PHP_METHOD(HttpUrl, parse)
-{
- char *str;
- int len;
- long flags = 0;
- php_http_url_t *url;
- zend_error_handling zeh;
-
- php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &len, &flags), invalid_arg, return);
-
- zend_replace_error_handling(EH_THROW, php_http_exception_bad_url_class_entry, &zeh TSRMLS_CC);
- if ((url = php_http_url_parse(str, len, flags TSRMLS_CC))) {
- object_init_ex(return_value, php_http_url_class_entry);
- if (url->scheme) {
- zend_update_property_string(php_http_url_class_entry, return_value,
- ZEND_STRL("scheme"), url->scheme TSRMLS_CC);
- }
- if (url->user) {
- zend_update_property_string(php_http_url_class_entry, return_value,
- ZEND_STRL("user"), url->user TSRMLS_CC);
- }
- if (url->pass) {
- zend_update_property_string(php_http_url_class_entry, return_value,
- ZEND_STRL("pass"), url->pass TSRMLS_CC);
- }
- if (url->host) {
- zend_update_property_string(php_http_url_class_entry, return_value,
- ZEND_STRL("host"), url->host TSRMLS_CC);
- }
- if (url->port) {
- zend_update_property_long(php_http_url_class_entry, return_value,
- ZEND_STRL("port"), url->port TSRMLS_CC);
- }
- if (url->path) {
- zend_update_property_string(php_http_url_class_entry, return_value,
- ZEND_STRL("path"), url->path TSRMLS_CC);
- }
- if (url->query) {
- zend_update_property_string(php_http_url_class_entry, return_value,
- ZEND_STRL("query"), url->query TSRMLS_CC);
- }
- if (url->fragment) {
- zend_update_property_string(php_http_url_class_entry, return_value,
- ZEND_STRL("fragment"), url->fragment TSRMLS_CC);
- }
- php_http_url_free(&url);
- }
- zend_restore_error_handling(&zeh TSRMLS_CC);
-}
-
static zend_function_entry php_http_url_methods[] = {
PHP_ME(HttpUrl, __construct, ai_HttpUrl___construct, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
PHP_ME(HttpUrl, mod, ai_HttpUrl_mod, ZEND_ACC_PUBLIC)
PHP_ME(HttpUrl, toString, ai_HttpUrl_toString, ZEND_ACC_PUBLIC)
ZEND_MALIAS(HttpUrl, __toString, toString, ai_HttpUrl_toString, ZEND_ACC_PUBLIC)
PHP_ME(HttpUrl, toArray, ai_HttpUrl_toArray, ZEND_ACC_PUBLIC)
- PHP_ME(HttpUrl, parse, ai_HttpUrl_parse, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
EMPTY_FUNCTION_ENTRY
};
http://example.com:55555/index?s=b&i=0&e=&a[]=1&a[]=2
https://example.com/?s=b&i=0&e=&a[]=1&a[]=2
http://example.com:55555/index.php/
-http://localhost/
+
DONE
foreach ($urls as $url) {
printf("\n%s\n", $url);
- var_dump(http\Url::parse($url));
+ var_dump(new http\Url($url, null, 0));
}
?>
foreach ($urls as $url) {
printf("\n%s\n", $url);
- var_dump(http\Url::parse($url));
+ var_dump(new http\Url($url, null, 0));
}
?>
DONE
foreach ($urls as $url) {
printf("\n%s\n", $url);
- var_dump(http\Url::parse($url));
+ var_dump(new http\Url($url, null, 0));
}
?>
DONE
foreach ($urls as $url) {
printf("\n%s\n", $url);
- var_dump(http\Url::parse($url, http\Url::PARSE_MBLOC));
+ var_dump(new http\Url($url, null, http\Url::PARSE_MBLOC));
}
?>
DONE
foreach ($urls as $url) {
printf("\n%s\n", $url);
- var_dump(http\Url::parse($url, http\Url::PARSE_MBUTF8));
+ var_dump(new http\Url($url, null, http\Url::PARSE_MBUTF8));
}
?>
DONE
foreach ($urls as $url) {
printf("\n%s\n", $url);
- var_dump(http\Url::parse($url, http\Url::PARSE_MBLOC|http\Url::PARSE_TOIDN));
+ var_dump(new http\Url($url, null, http\Url::PARSE_MBLOC|http\Url::PARSE_TOIDN));
}
?>
DONE
foreach ($urls as $url) {
printf("\n%s\n", $url);
- var_dump(http\Url::parse($url, http\Url::PARSE_MBUTF8|http\Url::PARSE_TOIDN));
+ var_dump(new http\Url($url, null, http\Url::PARSE_MBUTF8|http\Url::PARSE_TOIDN));
}
?>
DONE
foreach ($urls as $url) {
try {
printf("\n%s\n", $url);
- var_dump(http\Url::parse($url));
+ var_dump(new http\Url($url, null, 0));
} catch (Exception $e) {
echo $e->getMessage(),"\n";
}
Test
s://[a:80
-http\Url::parse(): Failed to parse hostinfo; expected ']'
+http\Url::__construct(): Failed to parse hostinfo; expected ']'
s://[0]
-http\Url::parse(): Failed to parse hostinfo; unexpected '['
+http\Url::__construct(): Failed to parse hostinfo; unexpected '['
s://[::1]:80
object(http\Url)#%d (8) {
foreach ($urls as $url) {
try {
printf("\n%s\n", $url);
- var_dump(http\Url::parse($url));
+ var_dump(new http\Url($url, null, 0));
} catch (Exception $e) {
echo $e->getMessage(),"\n";
}
);
foreach ($urls as $url) {
- var_dump(http\Url::parse($url, http\Url::PARSE_MBUTF8|http\Url::PARSE_TOPCT));
+ var_dump(new http\Url($url, null, http\Url::PARSE_MBUTF8|http\Url::PARSE_TOPCT));
}
?>
DONE