}
/* }}} */
-/* {{{ proto string http_build_url(mixed url[, mixed parts[, int flags = HTTP_URL_REPLACE[, array &new_url]]])
+/* {{{ proto string http_build_url([mixed url[, mixed parts[, int flags = HTTP_URL_REPLACE[, array &new_url]]]])
*
* Build an URL.
*
zval *z_old_url = NULL, *z_new_url = NULL, *z_composed_url = NULL;
php_url *old_url = NULL, *new_url = NULL, *composed_url = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/|z/lz", &z_old_url, &z_new_url, &flags, &z_composed_url) != SUCCESS) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z/z/lz", &z_old_url, &z_new_url, &flags, &z_composed_url) != SUCCESS) {
RETURN_FALSE;
}
}
}
- if (Z_TYPE_P(z_old_url) == IS_ARRAY || Z_TYPE_P(z_old_url) == IS_OBJECT) {
- old_url = array2url(HASH_OF(z_old_url));
- } else {
- convert_to_string(z_old_url);
- if (!(old_url = php_url_parse_ex(Z_STRVAL_P(z_old_url), Z_STRLEN_P(z_old_url)))) {
- if (new_url) {
- php_url_free(new_url);
+ if (z_old_url) {
+ if (Z_TYPE_P(z_old_url) == IS_ARRAY || Z_TYPE_P(z_old_url) == IS_OBJECT) {
+ old_url = array2url(HASH_OF(z_old_url));
+ } else {
+ convert_to_string(z_old_url);
+ if (!(old_url = php_url_parse_ex(Z_STRVAL_P(z_old_url), Z_STRLEN_P(z_old_url)))) {
+ if (new_url) {
+ php_url_free(new_url);
+ }
+ http_error_ex(HE_WARNING, HTTP_E_URL, "Could not parse URL (%s)", Z_STRVAL_P(z_old_url));
+ RETURN_FALSE;
}
- http_error_ex(HE_WARNING, HTTP_E_URL, "Could not parse URL (%s)", Z_STRVAL_P(z_old_url));
- RETURN_FALSE;
}
}
if (new_url) {
php_url_free(new_url);
}
- php_url_free(old_url);
+ if (old_url) {
+ php_url_free(old_url);
+ }
RETURN_STRINGL(url_str, url_len, 0);
}
*/
PHP_FUNCTION(http_redirect)
{
- int url_len;
+ int url_len = 0;
size_t query_len = 0;
zend_bool session = 0, free_params = 0;
zval *params = NULL;