diff options
| author | Ondřej Surý <ondrej@sury.org> | 2014-03-27 15:35:16 +0100 |
|---|---|---|
| committer | Ondřej Surý <ondrej@sury.org> | 2014-03-27 15:35:16 +0100 |
| commit | 30bdcf2392ef8cc7b8b4a07b49367571ae1db286 (patch) | |
| tree | c98975e6a71c722e7ce3b31c7c221ceb0e9a1f25 /sapi | |
| parent | d67160a566757f858e5883201e518230f5221c6b (diff) | |
| download | php-30bdcf2392ef8cc7b8b4a07b49367571ae1db286.tar.gz | |
New upstream version 5.6.0~alpha3+dfsgupstream/5.6.0_alpha3+dfsg
Diffstat (limited to 'sapi')
26 files changed, 60 insertions, 45 deletions
diff --git a/sapi/cgi/tests/010.phpt b/sapi/cgi/tests/010.phpt index e633ad28b..67e1a69e2 100644 --- a/sapi/cgi/tests/010.phpt +++ b/sapi/cgi/tests/010.phpt @@ -40,14 +40,14 @@ echo "Done\n"; --EXPECTF-- Status: 403 Forbidden X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 Status: 403 Forbidden X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 X-Powered-By: PHP/%s Status: 403 Also Forbidden -Content-type: text/html +Content-type: text/html; charset=UTF-8 Done diff --git a/sapi/cgi/tests/011.phpt b/sapi/cgi/tests/011.phpt index 177df021a..6d4a6ed7f 100644 --- a/sapi/cgi/tests/011.phpt +++ b/sapi/cgi/tests/011.phpt @@ -65,18 +65,18 @@ header_remove("X-Foo"); <?php ?> ---------- X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php header_remove(); ?> ---------- -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php header_remove("X-Foo"); ?> ---------- X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php @@ -85,7 +85,7 @@ header("X-Foo: Bar"); ---------- X-Powered-By: PHP/%s X-Foo: Bar -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php @@ -96,7 +96,7 @@ header_remove("X-Foo"); ---------- X-Powered-By: PHP/%s X-Bar: Baz -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php @@ -106,7 +106,7 @@ header_remove("X-Foo: Bar"); ---------- X-Powered-By: PHP/%s X-Foo: Bar -Content-type: text/html +Content-type: text/html; charset=UTF-8 Warning: Header to delete may not contain colon. in %s on line 3 @@ -118,7 +118,7 @@ header_remove("X-Foo:"); ---------- X-Powered-By: PHP/%s X-Foo: Bar -Content-type: text/html +Content-type: text/html; charset=UTF-8 Warning: Header to delete may not contain colon. in %s on line 3 @@ -128,7 +128,7 @@ header("X-Foo: Bar"); header_remove(); ?> ---------- -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php @@ -136,7 +136,7 @@ header_remove(""); ?> ---------- X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php @@ -144,7 +144,7 @@ header_remove(":"); ?> ---------- X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 Warning: Header to delete may not contain colon. in %s on line 2 @@ -158,7 +158,7 @@ header_remove("X-Foo"); ---------- X-Powered-By: PHP/%s X-Foo: Bar -Content-type: text/html +Content-type: text/html; charset=UTF-8 flush diff --git a/sapi/cli/tests/bug43177.phpt b/sapi/cli/tests/bug43177.phpt index 36b5504ab..a97769cf8 100644 --- a/sapi/cli/tests/bug43177.phpt +++ b/sapi/cli/tests/bug43177.phpt @@ -60,23 +60,23 @@ HTTP/1.1 200 OK Host: localhost Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 OK HTTP/1.0 500 Internal Server Error Host: localhost Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 HTTP/1.0 500 Internal Server Error Host: localhost Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 HTTP/1.0 500 Internal Server Error Host: localhost Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 diff --git a/sapi/cli/tests/bug65066_100.phpt b/sapi/cli/tests/bug65066_100.phpt index 3a97c7e91..901ba188f 100644 --- a/sapi/cli/tests/bug65066_100.phpt +++ b/sapi/cli/tests/bug65066_100.phpt @@ -36,4 +36,4 @@ HTTP/1.1 100 Continue Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 diff --git a/sapi/cli/tests/bug65066_422.phpt b/sapi/cli/tests/bug65066_422.phpt index 2552d1d11..4e5d31c7a 100644 --- a/sapi/cli/tests/bug65066_422.phpt +++ b/sapi/cli/tests/bug65066_422.phpt @@ -36,4 +36,4 @@ HTTP/1.1 422 Unknown Status Code Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 diff --git a/sapi/cli/tests/bug65066_511.phpt b/sapi/cli/tests/bug65066_511.phpt index aa4a9a003..a0b4eae39 100644 --- a/sapi/cli/tests/bug65066_511.phpt +++ b/sapi/cli/tests/bug65066_511.phpt @@ -36,4 +36,4 @@ HTTP/1.1 511 Network Authentication Required Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 diff --git a/sapi/cli/tests/bug65633.phpt b/sapi/cli/tests/bug65633.phpt index 55834095b..456436b1f 100644 --- a/sapi/cli/tests/bug65633.phpt +++ b/sapi/cli/tests/bug65633.phpt @@ -39,7 +39,7 @@ fclose($fp); HTTP/1.1 200 OK Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 array(1) { ["foo"]=> diff --git a/sapi/cli/tests/php_cli_server_004.phpt b/sapi/cli/tests/php_cli_server_004.phpt index b61f88637..8b913f659 100644 --- a/sapi/cli/tests/php_cli_server_004.phpt +++ b/sapi/cli/tests/php_cli_server_004.phpt @@ -40,7 +40,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(19) "HTTP_HOST:localhost" string(21) "HTTP_USER_AGENT:dummy" diff --git a/sapi/cli/tests/php_cli_server_005.phpt b/sapi/cli/tests/php_cli_server_005.phpt index ccc0f8f3a..cdd0ae902 100644 --- a/sapi/cli/tests/php_cli_server_005.phpt +++ b/sapi/cli/tests/php_cli_server_005.phpt @@ -52,7 +52,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 array(1) { ["userfile"]=> diff --git a/sapi/cli/tests/php_cli_server_006.phpt b/sapi/cli/tests/php_cli_server_006.phpt index 09e7ab07a..ad6d6c959 100644 --- a/sapi/cli/tests/php_cli_server_006.phpt +++ b/sapi/cli/tests/php_cli_server_006.phpt @@ -36,7 +36,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(3) "foo" string(3) "bar" diff --git a/sapi/cli/tests/php_cli_server_007.phpt b/sapi/cli/tests/php_cli_server_007.phpt index 64d4df0ed..6420ff5a4 100644 --- a/sapi/cli/tests/php_cli_server_007.phpt +++ b/sapi/cli/tests/php_cli_server_007.phpt @@ -37,4 +37,4 @@ Host: %s Connection: close X-Powered-By: PHP/%s WWW-Authenticate: Digest realm="foo",qop="auth",nonce="XXXXX",opaque="acbd18db4cc2f85cedef654fccc4a4d8" -Content-type: text/html +Content-type: text/html; charset=UTF-8 diff --git a/sapi/cli/tests/php_cli_server_008.phpt b/sapi/cli/tests/php_cli_server_008.phpt index 2e68e2405..01f825a74 100644 --- a/sapi/cli/tests/php_cli_server_008.phpt +++ b/sapi/cli/tests/php_cli_server_008.phpt @@ -56,13 +56,13 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(8) "HTTP/1.1" HTTP/1.0 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(8) "HTTP/1.0" diff --git a/sapi/cli/tests/php_cli_server_009.phpt b/sapi/cli/tests/php_cli_server_009.phpt index 2beaeedab..231797160 100644 --- a/sapi/cli/tests/php_cli_server_009.phpt +++ b/sapi/cli/tests/php_cli_server_009.phpt @@ -80,14 +80,14 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(8) "/foo/bar" HTTP/1.0 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(9) "/foo/bar/" HTTP/1.0 404 Not Found diff --git a/sapi/cli/tests/php_cli_server_010.phpt b/sapi/cli/tests/php_cli_server_010.phpt index 2ef018b85..30e6d047a 100644 --- a/sapi/cli/tests/php_cli_server_010.phpt +++ b/sapi/cli/tests/php_cli_server_010.phpt @@ -57,7 +57,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(18) "/index.php/foo/bar" string(10) "/index.php" @@ -67,7 +67,7 @@ HTTP/1.0 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(19) "/index.php/foo/bar/" string(10) "/index.php" diff --git a/sapi/cli/tests/php_cli_server_012.phpt b/sapi/cli/tests/php_cli_server_012.phpt index 9a1e60c48..302540f7e 100644 --- a/sapi/cli/tests/php_cli_server_012.phpt +++ b/sapi/cli/tests/php_cli_server_012.phpt @@ -42,7 +42,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 Array ( diff --git a/sapi/cli/tests/php_cli_server_015.phpt b/sapi/cli/tests/php_cli_server_015.phpt index 6fb016924..e3d8c4170 100644 --- a/sapi/cli/tests/php_cli_server_015.phpt +++ b/sapi/cli/tests/php_cli_server_015.phpt @@ -43,7 +43,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 <br /> <b>Fatal error</b>: Call to undefined function non_exists_function() in <b>%ssyntax_error.php</b> on line <b>%s</b><br /> diff --git a/sapi/cli/tests/php_cli_server_017.phpt b/sapi/cli/tests/php_cli_server_017.phpt index 73530af48..34e7d5e28 100644 --- a/sapi/cli/tests/php_cli_server_017.phpt +++ b/sapi/cli/tests/php_cli_server_017.phpt @@ -39,6 +39,6 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(%d) "%sindex.php" diff --git a/sapi/cli/tests/php_cli_server_018.phpt b/sapi/cli/tests/php_cli_server_018.phpt index deb934876..44e129293 100644 --- a/sapi/cli/tests/php_cli_server_018.phpt +++ b/sapi/cli/tests/php_cli_server_018.phpt @@ -39,6 +39,6 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(5) "PATCH" diff --git a/sapi/cli/tests/php_cli_server_019.phpt b/sapi/cli/tests/php_cli_server_019.phpt index 2b983e5c0..aeb7a9f89 100644 --- a/sapi/cli/tests/php_cli_server_019.phpt +++ b/sapi/cli/tests/php_cli_server_019.phpt @@ -44,7 +44,7 @@ Host: %s Connection: close X-Powered-By: %s Bar-Foo: Foo -Content-type: text/html +Content-type: text/html; charset=UTF-8 array(2) { ["Host"]=> @@ -64,5 +64,5 @@ array(3) { ["Bar-Foo"]=> string(3) "Foo" ["Content-type"]=> - string(9) "text/html" + string(24) "text/html; charset=UTF-8" } diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt index b8416ea73..707eddbad 100644 --- a/sapi/cli/tests/upload_2G.phpt +++ b/sapi/cli/tests/upload_2G.phpt @@ -43,7 +43,7 @@ if (!$fp) { } $prev = "----123 -Content-Type: text/plain +Content-Type: text/plain; charset=UTF-8 Content-Disposition: form-data; name=\"file1\"; filename=\"file1.txt\"\n\n"; $post = "\n----123--\n"; $total = $length + strlen($prev) + strlen($post); @@ -79,7 +79,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 array(1) { ["file1"]=> diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 20adf91df..ae7908642 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -148,6 +148,7 @@ static struct ini_value_parser_s ini_fpm_pool_options[] = { { "chroot", &fpm_conf_set_string, WPO(chroot) }, { "chdir", &fpm_conf_set_string, WPO(chdir) }, { "catch_workers_output", &fpm_conf_set_boolean, WPO(catch_workers_output) }, + { "clear_env", &fpm_conf_set_boolean, WPO(clear_env) }, { "security.limit_extensions", &fpm_conf_set_string, WPO(security_limit_extensions) }, #ifdef HAVE_APPARMOR { "apparmor_hat", &fpm_conf_set_string, WPO(apparmor_hat) }, @@ -606,6 +607,7 @@ static void *fpm_worker_pool_config_alloc() /* {{{ */ wp->config->listen_backlog = FPM_BACKLOG_DEFAULT; wp->config->pm_process_idle_timeout = 10; /* 10s by default */ wp->config->process_priority = 64; /* 64 means unset */ + wp->config->clear_env = 1; if (!fpm_worker_all_pools) { fpm_worker_all_pools = wp; @@ -1606,6 +1608,7 @@ static void fpm_conf_dump() /* {{{ */ zlog(ZLOG_NOTICE, "\tchroot = %s", STR2STR(wp->config->chroot)); zlog(ZLOG_NOTICE, "\tchdir = %s", STR2STR(wp->config->chdir)); zlog(ZLOG_NOTICE, "\tcatch_workers_output = %s", BOOL2STR(wp->config->catch_workers_output)); + zlog(ZLOG_NOTICE, "\tclear_env = %s", BOOL2STR(wp->config->clear_env)); zlog(ZLOG_NOTICE, "\tsecurity.limit_extensions = %s", wp->config->security_limit_extensions); for (kv = wp->config->env; kv; kv = kv->next) { diff --git a/sapi/fpm/fpm/fpm_conf.h b/sapi/fpm/fpm/fpm_conf.h index 4b2974904..12fabe280 100644 --- a/sapi/fpm/fpm/fpm_conf.h +++ b/sapi/fpm/fpm/fpm_conf.h @@ -83,6 +83,7 @@ struct fpm_worker_pool_config_s { char *chroot; char *chdir; int catch_workers_output; + int clear_env; char *security_limit_extensions; struct key_value_s *env; struct key_value_s *php_admin_values; diff --git a/sapi/fpm/fpm/fpm_env.c b/sapi/fpm/fpm/fpm_env.c index 6b64fedfe..2ff0bdc0e 100644 --- a/sapi/fpm/fpm/fpm_env.c +++ b/sapi/fpm/fpm/fpm_env.c @@ -143,7 +143,9 @@ int fpm_env_init_child(struct fpm_worker_pool_s *wp) /* {{{ */ fpm_env_setproctitle(title); efree(title); - clearenv(); + if (wp->config->clear_env) { + clearenv(); + } for (kv = wp->config->env; kv; kv = kv->next) { setenv(kv->key, kv->value, 1); diff --git a/sapi/fpm/php-fpm.conf.in b/sapi/fpm/php-fpm.conf.in index 9002a2933..ab03736be 100644 --- a/sapi/fpm/php-fpm.conf.in +++ b/sapi/fpm/php-fpm.conf.in @@ -475,6 +475,15 @@ pm.max_spare_servers = 3 ; Default Value: no ;catch_workers_output = yes +; Clear environment in FPM workers +; Prevents arbitrary environment variables from reaching FPM worker processes +; by clearing the environment in workers before env vars specified in this +; pool configuration are added. +; Setting to "no" will make all environment variables available to PHP code +; via getenv(), $_ENV and $_SERVER. +; Default Value: yes +;clear_env = no + ; Limits the extensions of the main script FPM will allow to parse. This can ; prevent configuration mistakes on the web server side. You should only limit ; FPM to .php extensions to prevent malicious users to use other extensions to diff --git a/sapi/fpm/tests/apparmor.phpt b/sapi/fpm/tests/apparmor.phpt index cf9bd7111..e0f051998 100644 --- a/sapi/fpm/tests/apparmor.phpt +++ b/sapi/fpm/tests/apparmor.phpt @@ -3,7 +3,7 @@ FPM: Apparmor Test --DESCRIPTION-- This test tries to launches a pool which tries to change to non existing apparmor hat a. Test succeeds if apparmor is not running or hat is non -existant. +existent. --SKIPIF-- <?php include "skipif.inc"; @@ -39,7 +39,7 @@ EOT; - failed to change to new confinement something in apparmor went wrong - exited with code 70 - Change to successful; Hat not existant (Process gets killed by apparmor) + Change to successful; Hat not existent (Process gets killed by apparmor) */ var_dump(run_fpm_till('/(SIGSEGV|failed to query apparmor confinement|failed to change to new confinement|exited with code 70)/', $cfg)); diff --git a/sapi/phpdbg/phpdbg_help.c b/sapi/phpdbg/phpdbg_help.c index a02cb41c1..d2fea8d7c 100644 --- a/sapi/phpdbg/phpdbg_help.c +++ b/sapi/phpdbg/phpdbg_help.c @@ -268,7 +268,7 @@ PHPDBG_HELP(break) /* {{{ */ phpdbg_writeln(EMPTY); phpdbg_writeln("\t%sbreak op ZEND_ADD", phpdbg_get_prompt(TSRMLS_C)); phpdbg_writeln("\t%sb O ZEND_ADD", phpdbg_get_prompt(TSRMLS_C)); - phpdbg_writeln("\tWill break on every occurence of the opcode provided"); + phpdbg_writeln("\tWill break on every occurrence of the opcode provided"); phpdbg_writeln(EMPTY); phpdbg_writeln("\t%sbreak del 1", phpdbg_get_prompt(TSRMLS_C)); phpdbg_writeln("\t%sb d 1", phpdbg_get_prompt(TSRMLS_C)); @@ -574,7 +574,7 @@ PHPDBG_HELP(options) /* {{{ */ phpdbg_writeln(" -c\t-c/my/php.ini\t\tSet php.ini file to load"); phpdbg_writeln(" -d\t-dmemory_limit=4G\tSet a php.ini directive"); phpdbg_writeln(" -n\tN/A\t\t\tDisable default php.ini"); - phpdbg_writeln(" -q\tN/A\t\t\tSupress welcome banner"); + phpdbg_writeln(" -q\tN/A\t\t\tSuppress welcome banner"); phpdbg_writeln(" -e\t-emytest.php\t\tSet execution context"); phpdbg_writeln(" -v\tN/A\t\t\tEnable oplog output"); phpdbg_writeln(" -s\tN/A\t\t\tEnable stepping"); |
