]> granicus.if.org Git - php/commitdiff
MFH: Response to: [PHP-DEV] cleaning up the functions - any volunteers? :)
authorUwe Schindler <thetaphi@php.net>
Sun, 22 Jun 2008 18:09:41 +0000 (18:09 +0000)
committerUwe Schindler <thetaphi@php.net>
Sun, 22 Jun 2008 18:09:41 +0000 (18:09 +0000)
sapi/nsapi/nsapi.c

index 54609a1c5e70812f1ad6a6e8e700ec229452fe71..19c1572af98ca8a3df447019678991a23beb3cce 100644 (file)
@@ -327,22 +327,20 @@ PHP_MINFO_FUNCTION(nsapi)
  */
 PHP_FUNCTION(nsapi_virtual)
 {
-       zval **uri;
-       int rv;
-       char *value;
+       int uri_len,rv;
+       char *uri,*value;
        Request *rq;
        nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
 
-       if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &uri) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &uri, &uri_len) == FAILURE) {
+               return;
        }
-       convert_to_string_ex(uri);
 
        if (!nsapi_servact_service) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include uri '%s' - Sub-requests not supported on this platform", (*uri)->value.str.val);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include uri '%s' - Sub-requests not supported on this platform", uri);
                RETURN_FALSE;
        } else if (zend_ini_long("zlib.output_compression", sizeof("zlib.output_compression"), 0)) {
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include uri '%s' - Sub-requests do not work with zlib.output_compression", (*uri)->value.str.val);
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include uri '%s' - Sub-requests do not work with zlib.output_compression", uri);
                RETURN_FALSE;
        } else {
                php_end_ob_buffers(1 TSRMLS_CC);
@@ -350,8 +348,8 @@ PHP_FUNCTION(nsapi_virtual)
 
                /* do the sub-request */
                /* thanks to Chris Elving from Sun for this code sniplet */
-               if ((rq = request_restart_internal((*uri)->value.str.val, NULL)) == NULL) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include uri '%s' - Internal request creation failed", (*uri)->value.str.val);
+               if ((rq = request_restart_internal(uri, NULL)) == NULL) {
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include uri '%s' - Internal request creation failed", uri);
                        RETURN_FALSE;
                }
 
@@ -383,7 +381,7 @@ PHP_FUNCTION(nsapi_virtual)
                } while (rv == REQ_RESTART);
 
                if (rq->status_num != 200) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include uri '%s' - HTTP status code %d during subrequest", (*uri)->value.str.val, rq->status_num);
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to include uri '%s' - HTTP status code %d during subrequest", uri, rq->status_num);
                        request_free(rq);
                        RETURN_FALSE;
                }
@@ -403,6 +401,10 @@ PHP_FUNCTION(nsapi_request_headers)
        struct pb_entry *entry;
        nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
 
+       if (zend_parse_parameters_none() == FAILURE) {
+               return;
+       }
+       
        array_init(return_value);
 
        for (i=0; i < rc->rq->headers->hsize; i++) {
@@ -425,6 +427,10 @@ PHP_FUNCTION(nsapi_response_headers)
        struct pb_entry *entry;
        nsapi_request_context *rc = (nsapi_request_context *)SG(server_context);
 
+       if (zend_parse_parameters_none() == FAILURE) {
+               return;
+       }
+       
        array_init(return_value);
 
        php_header(TSRMLS_C);