From: Zeev Suraski Date: Mon, 7 May 2001 11:07:22 +0000 (+0000) Subject: Allow virtual() of PHP files. We may have to improve the detection code a X-Git-Tag: php-4.0.6RC1~87 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d229f82a46055e86395f477e3b5754a3bdf215c5;p=php Allow virtual() of PHP files. We may have to improve the detection code a bit, but it worked well on everything I tried. --- diff --git a/sapi/apache/mod_php4.c b/sapi/apache/mod_php4.c index 237e7e0aa7..fc15c3d93e 100644 --- a/sapi/apache/mod_php4.c +++ b/sapi/apache/mod_php4.c @@ -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); } diff --git a/sapi/apache/php_apache.c b/sapi/apache/php_apache.c index f5890ba8a9..2ae7dca282 100644 --- a/sapi/apache/php_apache.c +++ b/sapi/apache/php_apache.c @@ -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 <?include \"%s\"> instead)", (*filename)->value.str.val); - if (rr) destroy_sub_req (rr); - RETURN_FALSE; - } - php_end_ob_buffers(1); php_header();