diff options
| author | Ondřej Surý <ondrej@sury.org> | 2010-01-08 13:08:00 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2010-01-08 13:08:00 +0100 |
| commit | 176cbd0bc99e20bb21f92f0b72df728eafc1e2ce (patch) | |
| tree | 58b249aa9e26b7c5754abb2a78563eab074a950b /sapi | |
| parent | 10544de9849f8704aaeb54388e9795f2273202a0 (diff) | |
| download | php-176cbd0bc99e20bb21f92f0b72df728eafc1e2ce.tar.gz | |
Imported Upstream version 5.2.12.dfsg.1upstream/5.2.12.dfsg.1
Diffstat (limited to 'sapi')
| -rw-r--r-- | sapi/apache2handler/sapi_apache2.c | 43 | ||||
| -rw-r--r-- | sapi/cgi/cgi_main.c | 27 | ||||
| -rw-r--r-- | sapi/cli/php.1.in | 14 | ||||
| -rw-r--r-- | sapi/cli/php_cli.c | 7 | ||||
| -rw-r--r-- | sapi/cli/php_cli_readline.c | 6 |
5 files changed, 55 insertions, 42 deletions
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 4cdad3ae9..679a30fc0 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: sapi_apache2.c 272374 2008-12-31 11:17:49Z sebastian $ */ +/* $Id: sapi_apache2.c 291305 2009-11-25 12:35:42Z jani $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -99,7 +99,7 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header,sapi_headers_stru ptr = val; *val = '\0'; - + do { val++; } while (*val == ' '); @@ -115,7 +115,7 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header,sapi_headers_stru apr_table_add(ctx->r->headers_out, sapi_header->header, val); } *ptr = ':'; - + return SAPI_HEADER_ADD; } @@ -136,8 +136,8 @@ php_apache_sapi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC) apr_table_set(ctx->r->subprocess_env, "force-response-1.0", "true"); } } - - /* call ap_set_content_type only once, else each time we call it, + + /* call ap_set_content_type only once, else each time we call it, configured output filters for that content type will be added */ if (!ctx->content_type) { ctx->content_type = sapi_get_default_content_type(TSRMLS_C); @@ -177,7 +177,7 @@ php_apache_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC) buf += len; len = count_bytes - tlen; } - + return tlen; } @@ -223,6 +223,10 @@ php_apache_sapi_getenv(char *name, size_t name_len TSRMLS_DC) { php_struct *ctx = SG(server_context); const char *env_var; + + if (ctx == NULL) { + return NULL; + } env_var = apr_table_get(ctx->r->subprocess_env, name); @@ -301,7 +305,8 @@ static void php_apache_sapi_log_message_ex(char *msg, request_rec *r) } } -static time_t php_apache_sapi_get_request_time(TSRMLS_D) { +static time_t php_apache_sapi_get_request_time(TSRMLS_D) +{ php_struct *ctx = SG(server_context); return apr_time_sec(ctx->r->request_time); } @@ -380,7 +385,7 @@ static int php_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp int threaded_mpm; ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded_mpm); - if(threaded_mpm) { + if (threaded_mpm) { ap_log_error(APLOG_MARK, APLOG_CRIT, 0, 0, "Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP."); return DONE; } @@ -484,12 +489,12 @@ typedef struct { uint str_len; php_conf_rec *c = ap_get_module_config(r->per_dir_config, &php5_module); - for (zend_hash_internal_pointer_reset(&c->config); - zend_hash_get_current_key_ex(&c->config, &str, &str_len, NULL, 0, NULL) == HASH_KEY_IS_STRING; - zend_hash_move_forward(&c->config) + for (zend_hash_internal_pointer_reset(&c->config); + zend_hash_get_current_key_ex(&c->config, &str, &str_len, NULL, 0, NULL) == HASH_KEY_IS_STRING; + zend_hash_move_forward(&c->config) ) { zend_restore_ini_entry(str, str_len, ZEND_INI_STAGE_SHUTDOWN); - } + } } if (p) { ((php_struct *)SG(server_context))->r = p; @@ -539,7 +544,7 @@ normal: } /* Give a 404 if PATH_INFO is used but is explicitly disabled in - * the configuration; default behaviour is to accept. */ + * the configuration; default behaviour is to accept. */ if (r->used_path_info == AP_REQ_REJECT_PATH_INFO && r->path_info && r->path_info[0]) { PHPAP_INI_OFF; @@ -587,17 +592,17 @@ zend_first_try { if (!parent_req) { parent_req = ctx->r; } - if (parent_req && parent_req->handler && - strcmp(parent_req->handler, PHP_MAGIC_TYPE) && - strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE) && + if (parent_req && parent_req->handler && + strcmp(parent_req->handler, PHP_MAGIC_TYPE) && + strcmp(parent_req->handler, PHP_SOURCE_MAGIC_TYPE) && strcmp(parent_req->handler, PHP_SCRIPT)) { if (php_apache_request_ctor(r, ctx TSRMLS_CC)!=SUCCESS) { zend_bailout(); } } - - /* - * check if comming due to ErrorDocument + + /* + * check if comming due to ErrorDocument * We make a special exception of 413 (Invalid POST request) as the invalidity of the request occurs * during processing of the request by PHP during POST processing. Therefor we need to re-use the exiting * PHP instance to handle the request rather then creating a new one. diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index b38a6454a..e7481a95e 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cgi_main.c 281870 2009-06-09 13:29:39Z dsp $ */ +/* $Id: cgi_main.c 291497 2009-11-30 14:43:22Z dmitry $ */ #include "php.h" #include "php_globals.h" @@ -1496,8 +1496,9 @@ int main(int argc, char *argv[]) in case some server does something different than above */ && (!CGIG(redirect_status_env) || !getenv(CGIG(redirect_status_env))) ) { - SG(sapi_headers).http_response_code = 400; - PUTS("<b>Security Alert!</b> The PHP CGI cannot be accessed directly.\n\n\ + zend_try { + SG(sapi_headers).http_response_code = 400; + PUTS("<b>Security Alert!</b> The PHP CGI cannot be accessed directly.\n\n\ <p>This PHP CGI binary was compiled with force-cgi-redirect enabled. This\n\ means that a page will only be served up if the REDIRECT_STATUS CGI variable is\n\ set, e.g. via an Apache Action directive.</p>\n\ @@ -1506,7 +1507,8 @@ manual page for CGI security</a>.</p>\n\ <p>For more information about changing this behaviour or re-enabling this webserver,\n\ consult the installation file that came with this distribution, or visit \n\ <a href=\"http://php.net/install.windows\">the manual page</a>.</p>\n"); - + } zend_catch { + } zend_end_try(); #if defined(ZTS) && !defined(PHP_DEBUG) /* XXX we're crashing here in msvc6 debug builds at php_message_handler_for_zend:839 because @@ -1936,13 +1938,16 @@ consult the installation file that came with this distribution, or visit \n\ running from shell (so fp == NULL), then fail. */ if (retval == FAILURE && file_handle.handle.fp == NULL) { - if (errno == EACCES) { - SG(sapi_headers).http_response_code = 403; - PUTS("Access denied.\n"); - } else { - SG(sapi_headers).http_response_code = 404; - PUTS("No input file specified.\n"); - } + zend_try { + if (errno == EACCES) { + SG(sapi_headers).http_response_code = 403; + PUTS("Access denied.\n"); + } else { + SG(sapi_headers).http_response_code = 404; + PUTS("No input file specified.\n"); + } + } zend_catch { + } zend_end_try(); #if PHP_FASTCGI /* we want to serve more requests if this is fastcgi so cleanup and continue, request shutdown is diff --git a/sapi/cli/php.1.in b/sapi/cli/php.1.in index 68a24f5bc..1033bb5d9 100644 --- a/sapi/cli/php.1.in +++ b/sapi/cli/php.1.in @@ -69,7 +69,7 @@ specified by \-F to be executed. You can access the input line by \fB$argn\fP. While processing the input lines .B $argi contains the number of the actual line being processed. Further more -the paramters \-B and \-E can be used to execute +the parameters \-B and \-E can be used to execute .IR code (see \-r) before and after all input lines have been processed respectively. Notice that the @@ -304,6 +304,9 @@ Shows information about extension .IR name Shows configuration for extension .B name +.TP +.B \-\-ini +Show configuration file names .SH FILES .TP 15 .B php\-cli.ini @@ -315,7 +318,7 @@ The standard configuration file will only be used when cannot be found. .SH EXAMPLES .TP 5 -\fIphp -r 'echo "Hello World\\n";'\fP +\fIphp \-r 'echo "Hello World\\n";'\fP This command simply writes the text "Hello World" to standard out. .TP \fIphp \-r 'print_r(gd_info());'\fP @@ -339,7 +342,7 @@ configuration information. If you then combine those two Using this PHP command you can count the lines being input. .TP \fIphp \-R '@$l+=count(file($argn));' \-E 'echo "Lines:$l\\n";'\fP -In this example PHP expects each input line beeing a file. It counts all lines +In this example PHP expects each input line being a file. It counts all lines of the files specified by each input line and shows the summarized result. You may combine this with tools like find and change the php scriptlet. .TP @@ -372,11 +375,6 @@ For a more or less complete description of PHP look here: .B http://www.php.net/manual/ .PD 1 .P -A nice introduction to PHP by Stig Bakken can be found here: -.PD 0 -.P -.B http://www.zend.com/zend/art/intro.php -.PD 1 .SH BUGS You can view the list of known bugs or report any new bug you found at: diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c index ba767f5d0..891c551db 100644 --- a/sapi/cli/php_cli.c +++ b/sapi/cli/php_cli.c @@ -20,7 +20,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_cli.c 284649 2009-07-23 14:54:04Z jani $ */ +/* $Id: php_cli.c 292081 2009-12-13 17:06:47Z felipe $ */ #include "php.h" #include "php_globals.h" @@ -76,8 +76,11 @@ #endif #if (HAVE_LIBREADLINE || HAVE_LIBEDIT) && !defined(COMPILE_DL_READLINE) + +#if HAVE_LIBEDIT +#include <editline/readline.h> +#else #include <readline/readline.h> -#if !HAVE_LIBEDIT #include <readline/history.h> #endif #include "php_cli_readline.h" diff --git a/sapi/cli/php_cli_readline.c b/sapi/cli/php_cli_readline.c index e6398f212..ca4535ae4 100644 --- a/sapi/cli/php_cli_readline.c +++ b/sapi/cli/php_cli_readline.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_cli_readline.c 272374 2008-12-31 11:17:49Z sebastian $ */ +/* $Id: php_cli_readline.c 292081 2009-12-13 17:06:47Z felipe $ */ #include "php.h" @@ -49,8 +49,10 @@ #include <unixlib/local.h> #endif +#if HAVE_LIBEDIT +#include <editline/readline.h> +#else #include <readline/readline.h> -#if !HAVE_LIBEDIT #include <readline/history.h> #endif |
