summaryrefslogtreecommitdiff
path: root/sapi/cli
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-07-01 09:10:36 +0200
committerAnatol Belski <ab@php.net>2014-07-01 09:10:36 +0200
commit1a50c27f998769c5b3472d35c39852286900db69 (patch)
tree3c83075a87d566d3d2cac23523ce3f737805aa32 /sapi/cli
parentd4cfc15514285d42f113facc1c296d32a818ccf2 (diff)
parent2330be5641c907b7edd7cffdd3074e85d0091df5 (diff)
downloadphp-git-1a50c27f998769c5b3472d35c39852286900db69.tar.gz
Merge remote-tracking branch 'origin/PHP-5.6' into str_size_and_int64_56_backport
* origin/PHP-5.6: (170 commits) Fixed possible crash because of race conditions on modifying constants in shared memory remove the NEWS entry for the reverted fpm fix remove the NEWS entry for the reverted fpm fix remove the NEWS entry for the reverted fpm fix Revert "Fix Bug #67530 error_log=syslog ignored" --enable-fpm for the travis build fix the last fpm NEWS entry, the other bug is related, but not the same what we fixed here NEWS NEWS Fix bug #67091: make install fails to install libphp5.so on FreeBSD 10.0 adding NEWS entry for the fix for bug #65641 Updated NEWS file for recent phpdbg fixes Fixed issue krakjoe/phpdbg#94 - List behavior is inconsistent Fix issue krakjoe/phpdbg#97 - list now appends a newline if there is none The prompt should always ensure it is on a newline Fixed test Inform about back command existence in help - Fixes krakjoe/phpdbg#100 No way to list the current stack/frames Fix issue krakjoe/phpdbg#98 break if does not seem to work Fix issue krakjoe/phpdbg#99 register function has the same behavior as run Fix readline/libedit (Thanks to @remicollet) Replace incorrect `E` command with `ev` in watch help ... Conflicts: Zend/zend_compile.c ext/standard/basic_functions.c ext/standard/http_fopen_wrapper.c ext/standard/var.c ext/tokenizer/tokenizer_data.c sapi/phpdbg/phpdbg_list.c
Diffstat (limited to 'sapi/cli')
-rw-r--r--sapi/cli/php.1.in4
-rw-r--r--sapi/cli/php_cli_server.c10
-rw-r--r--sapi/cli/tests/bug67429.phpt49
3 files changed, 56 insertions, 7 deletions
diff --git a/sapi/cli/php.1.in b/sapi/cli/php.1.in
index 8672b3ba33..4d536df53c 100644
--- a/sapi/cli/php.1.in
+++ b/sapi/cli/php.1.in
@@ -1,4 +1,4 @@
-.TH PHP 1 "2013" "The PHP Group" "Scripting Language"
+.TH PHP 1 "2014" "The PHP Group" "Scripting Language"
.SH NAME
php \- PHP Command Line Interface 'CLI'
.P
@@ -454,7 +454,7 @@ contributors all around the world.
.SH VERSION INFORMATION
This manpage describes \fBphp\fP, version @PHP_VERSION@.
.SH COPYRIGHT
-Copyright \(co 1997\-2013 The PHP Group
+Copyright \(co 1997\-2014 The PHP Group
.LP
This source file is subject to version 3.01 of the PHP license,
that is bundled with this package in the file LICENSE, and is
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index d2d770d4d3..5087b68a98 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -223,6 +223,7 @@ static php_cli_server_http_response_status_code_pair status_map[] = {
{ 304, "Not Modified" },
{ 305, "Use Proxy" },
{ 307, "Temporary Redirect" },
+ { 308, "Permanent Redirect" },
{ 400, "Bad Request" },
{ 401, "Unauthorized" },
{ 402, "Payment Required" },
@@ -241,6 +242,7 @@ static php_cli_server_http_response_status_code_pair status_map[] = {
{ 415, "Unsupported Media Type" },
{ 416, "Requested Range Not Satisfiable" },
{ 417, "Expectation Failed" },
+ { 426, "Upgrade Required" },
{ 428, "Precondition Required" },
{ 429, "Too Many Requests" },
{ 431, "Request Header Fields Too Large" },
@@ -894,13 +896,11 @@ static void php_cli_server_poller_remove(php_cli_server_poller *poller, int mode
#endif
} /* }}} */
-static int php_cli_server_poller_poll(php_cli_server_poller *poller, const struct timeval *tv) /* {{{ */
+static int php_cli_server_poller_poll(php_cli_server_poller *poller, struct timeval *tv) /* {{{ */
{
- struct timeval t = *tv;
-
memmove(&poller->active.rfds, &poller->rfds, sizeof(poller->rfds));
memmove(&poller->active.wfds, &poller->wfds, sizeof(poller->wfds));
- return php_select(poller->max_fd + 1, &poller->active.rfds, &poller->active.wfds, NULL, &t);
+ return php_select(poller->max_fd + 1, &poller->active.rfds, &poller->active.wfds, NULL, tv);
} /* }}} */
static int php_cli_server_poller_iter_on_active(php_cli_server_poller *poller, void *opaque, int(*callback)(void *, php_socket_t fd, int events)) /* {{{ */
@@ -2477,7 +2477,7 @@ static int php_cli_server_do_event_loop(php_cli_server *server TSRMLS_DC) /* {{{
{
int retval = SUCCESS;
while (server->is_running) {
- static const struct timeval tv = { 1, 0 };
+ struct timeval tv = { 1, 0 };
int n = php_cli_server_poller_poll(&server->poller, &tv);
if (n > 0) {
php_cli_server_do_event_for_each_fd(server,
diff --git a/sapi/cli/tests/bug67429.phpt b/sapi/cli/tests/bug67429.phpt
new file mode 100644
index 0000000000..856946b29d
--- /dev/null
+++ b/sapi/cli/tests/bug67429.phpt
@@ -0,0 +1,49 @@
+--TEST--
+FR #67429 (CLI server is missing some new HTTP response codes)
+--SKIPIF--
+<?php
+include "skipif.inc";
+?>
+--FILE--
+<?php
+include "php_cli_server.inc";
+
+foreach ([308, 426] as $code) {
+ php_cli_server_start(<<<PHP
+http_response_code($code);
+PHP
+ );
+
+ list($host, $port) = explode(':', PHP_CLI_SERVER_ADDRESS);
+ $port = intval($port)?:80;
+
+ $fp = fsockopen($host, $port, $errno, $errstr, 0.5);
+ if (!$fp) {
+ die("connect failed");
+ }
+
+ if(fwrite($fp, <<<HEADER
+GET / HTTP/1.1
+
+
+HEADER
+ )) {
+ while (!feof($fp)) {
+ echo fgets($fp);
+ }
+ }
+
+ fclose($fp);
+}
+?>
+--EXPECTF--
+HTTP/1.1 308 Permanent Redirect
+Connection: close
+X-Powered-By: %s
+Content-type: text/html; charset=UTF-8
+
+HTTP/1.1 426 Upgrade Required
+Connection: close
+X-Powered-By: %s
+Content-type: text/html; charset=UTF-8
+