]> granicus.if.org Git - php/commitdiff
Allow virtual() of PHP files. We may have to improve the detection code a
authorZeev Suraski <zeev@php.net>
Mon, 7 May 2001 11:07:22 +0000 (11:07 +0000)
committerZeev Suraski <zeev@php.net>
Mon, 7 May 2001 11:07:22 +0000 (11:07 +0000)
bit, but it worked well on everything I tried.

sapi/apache/mod_php4.c
sapi/apache/php_apache.c

index 237e7e0aa7e6abda676411275acbb7c26bce2f9e..fc15c3d93e0d3ad8894c4757adbb77d9e35a7d79 100644 (file)
@@ -69,9 +69,9 @@ int sapi_apache_read_post(char *buffer, uint count_bytes SLS_DC);
 char *sapi_apache_read_cookies(SLS_D);
 int sapi_apache_header_handler(sapi_header_struct *sapi_header, sapi_headers_struct *sapi_headers SLS_DC);
 int sapi_apache_send_headers(sapi_headers_struct *sapi_headers SLS_DC);
-int send_php(request_rec *r, int display_source_mode, char *filename);
-int send_parsed_php(request_rec * r);
-int send_parsed_php_source(request_rec * r);
+static int send_php(request_rec *r, int display_source_mode, char *filename);
+static int send_parsed_php(request_rec * r);
+static int send_parsed_php_source(request_rec * r);
 int php_xbithack_handler(request_rec * r);
 void php_init_handler(server_rec *s, pool *p);
 
@@ -436,7 +436,7 @@ static char *php_apache_get_default_mimetype(request_rec *r SLS_DC)
        return mimetype;
 }
 
-int send_php(request_rec *r, int display_source_mode, char *filename)
+static int send_php(request_rec *r, int display_source_mode, char *filename)
 {
        int retval;
        HashTable *per_dir_conf;
@@ -446,6 +446,17 @@ int send_php(request_rec *r, int display_source_mode, char *filename)
        PLS_FETCH();
        APLS_FETCH();
 
+       if (r->assbackwards && r->protocol && !strcmp(r->protocol, "INCLUDED")) {
+               zend_file_handle fh;
+
+               fh.filename = r->filename;
+               fh.opened_path = NULL;
+               fh.free_filename = 0;
+               fh.type = ZEND_HANDLE_FILENAME;
+               zend_execute_scripts(ZEND_INCLUDE CLS_CC ELS_CC, 1, &fh);
+               return OK;
+       }
+
        if (setjmp(EG(bailout))!=0) {
                return OK;
        }
@@ -527,13 +538,13 @@ int send_php(request_rec *r, int display_source_mode, char *filename)
 }
 
 
-int send_parsed_php(request_rec * r)
+static int send_parsed_php(request_rec * r)
 {
        return send_php(r, 0, NULL);
 }
 
 
-int send_parsed_php_source(request_rec * r)
+static int send_parsed_php_source(request_rec * r)
 {
        return send_php(r, 1, NULL);
 }
index f5890ba8a9900ca756dfb6cb0f42499fdbf78e1c..2ae7dca282076e755c70522d0143155a65452306 100644 (file)
@@ -312,15 +312,6 @@ PHP_FUNCTION(virtual)
                RETURN_FALSE;
        }
 
-       /* Cannot include another PHP file because of global conflicts */
-       if (rr->content_type &&
-               !strcmp(rr->content_type, PHP_MIME_TYPE)) {
-               php_error(E_WARNING, "Cannot include a PHP file "
-                         "(use <code>&lt;?include \"%s\"&gt;</code> instead)", (*filename)->value.str.val);
-               if (rr) destroy_sub_req (rr);
-               RETURN_FALSE;
-       }
-       
        php_end_ob_buffers(1);
        php_header();