Back to index

php5  5.3.10
Defines | Functions
php_apache_http.h File Reference
#include "zend.h"
#include "zend_stack.h"
#include "ext/ereg/php_regex.h"
#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_main.h"
#include "http_protocol.h"
#include "http_request.h"
#include "http_log.h"
#include "util_script.h"
#include "php_variables.h"
#include "php_main.h"
#include "php_ini.h"
#include "ext/standard/php_standard.h"
#include "mod_php5.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define NO_REGEX_EXTRA_H

Functions

zval * php_apache_request_new (request_rec *r)
int apache_php_module_hook (request_rec *r, php_handler *handler, zval **ret TSRMLS_DC)

Define Documentation

Definition at line 1 of file php_apache_http.h.


Function Documentation

int apache_php_module_hook ( request_rec *  r,
php_handler handler,
zval **ret  TSRMLS_DC 
)

Definition at line 63 of file sapi_apache.c.

{
       zend_file_handle file_handle;
       zval *req;
    char *tmp;

#if PHP_SIGCHILD
       signal(SIGCHLD, sigchld_handler);
#endif
    if(AP(current_hook) == AP_RESPONSE) {
        if (php_request_startup_for_hook(TSRMLS_C) == FAILURE)
            return FAILURE;
    }
    else {
        if (php_request_startup_for_hook(TSRMLS_C) == FAILURE)
            return FAILURE;
    }

       req = php_apache_request_new(r);
    if(PG(register_globals)) {
        php_register_variable_ex("request", req, NULL TSRMLS_CC);
    }
    else {
        php_register_variable_ex("request", req, PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
    }
    switch(handler->type) {
        case AP_HANDLER_TYPE_FILE:
            php_register_variable("PHP_SELF_HOOK", handler->name, PG(http_globals)[TRACK_VARS_SERVER] TSRMLS_CC);
               memset(&file_handle, 0, sizeof(file_handle));
               file_handle.type = ZEND_HANDLE_FILENAME;
               file_handle.filename = handler->name;
               (void) php_execute_simple_script(&file_handle, ret TSRMLS_CC);
            break;
        case AP_HANDLER_TYPE_METHOD:
            if( (tmp = strstr(handler->name, "::")) != NULL &&  *(tmp+2) != '\0' ) {
                zval *class;
                zval *method;
                *tmp = '\0';
                ALLOC_ZVAL(class);
                ZVAL_STRING(class, handler->name, 1);
                ALLOC_ZVAL(method);
                ZVAL_STRING(method, tmp +2, 1);
                *tmp = ':';
                call_user_function_ex(EG(function_table), &class, method, ret, 0, NULL, 0, NULL TSRMLS_CC);
                zval_dtor(class);
                zval_dtor(method);
            }
            else {
                php_error(E_ERROR, "Unable to call %s - not a Class::Method\n", handler->name);
                /* not a class::method */
            }
            break;
        default:
            /* not a valid type */
            assert(0);
            break;
    }
       zval_dtor(req);
       AP(in_request) = 0;

       return OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

zval* php_apache_request_new ( request_rec *  r)

Definition at line 161 of file php_apache.c.

{
       zval *req;
       zval *addr;
       
       TSRMLS_FETCH();

       MAKE_STD_ZVAL(addr);
       Z_TYPE_P(addr) = IS_LONG;
       Z_LVAL_P(addr) = (int) r;

       MAKE_STD_ZVAL(req);
       object_init_ex(req, apacherequest_class_entry);
       zend_hash_index_update(Z_OBJPROP_P(req), 0, &addr, sizeof(zval *), NULL);

       return req;
}

Here is the caller graph for this function: