From 0b82e05fe264306004119e30119e665365331e17 Mon Sep 17 00:00:00 2001 From: Ondřej Surý Date: Fri, 16 Nov 2012 13:25:37 +0100 Subject: Imported Upstream version 5.5.0~alpha1 --- sapi/cli/php_cli_server.c | 86 ++++++++++++++-------------------- sapi/cli/tests/003-2.phpt | 0 sapi/cli/tests/php_cli_server_011.phpt | 41 ---------------- sapi/cli/tests/php_cli_server_013.phpt | 18 +++---- sapi/cli/tests/php_cli_server_014.phpt | 6 +-- 5 files changed, 48 insertions(+), 103 deletions(-) mode change 100755 => 100644 sapi/cli/tests/003-2.phpt delete mode 100644 sapi/cli/tests/php_cli_server_011.phpt (limited to 'sapi/cli') diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index 4d15db44a..d0d4cefb9 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -245,10 +245,10 @@ static php_cli_server_http_reponse_status_code_pair status_map[] = { }; static php_cli_server_http_reponse_status_code_pair template_map[] = { - { 400, "

%s

Your browser sent a request that this server could not understand.

" }, - { 404, "

%s

The requested resource %s was not found on this server.

" }, - { 500, "

%s

The server is temporarily unavailable.

" }, - { 501, "

%s

Request method not supported.

" } + { 400, "

%s

Your browser sent a request that this server could not understand.

" }, + { 404, "

%s

The requested resource %s was not found on this server.

" }, + { 500, "

%s

The server is temporarily unavailable.

" }, + { 501, "

%s

Request method not supported.

" } }; static php_cli_server_ext_mime_type_pair mime_type_map[] = { @@ -279,22 +279,10 @@ ZEND_DECLARE_MODULE_GLOBALS(cli_server); /* {{{ static char php_cli_server_css[] * copied from ext/standard/info.c */ -static const char php_cli_server_css[] = "\n"; +static const char php_cli_server_css[] = "\n"; /* }}} */ static void char_ptr_dtor_p(char **p) /* {{{ */ @@ -1757,7 +1745,7 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server escaped_request_uri = php_escape_html_entities_ex((unsigned char *)client->request.request_uri, client->request.request_uri_len, &escaped_request_uri_len, 0, ENT_QUOTES, NULL, 0 TSRMLS_CC); { - static const char prologue_template[] = "%d %s"; + static const char prologue_template[] = "%d %s"; php_cli_server_chunk *chunk = php_cli_server_chunk_heap_new_self_contained(strlen(prologue_template) + 3 + strlen(status_string) + 1); if (!chunk) { goto fail; @@ -1949,40 +1937,38 @@ static int php_cli_server_request_shutdown(php_cli_server *server, php_cli_serve static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server_client *client TSRMLS_DC) /* {{{ */ { int decline = 0; - if (!php_handle_special_queries(TSRMLS_C)) { - zend_file_handle zfd; - char *old_cwd; - - ALLOCA_FLAG(use_heap) - old_cwd = do_alloca(MAXPATHLEN, use_heap); - old_cwd[0] = '\0'; - php_ignore_value(VCWD_GETCWD(old_cwd, MAXPATHLEN - 1)); - - zfd.type = ZEND_HANDLE_FILENAME; - zfd.filename = server->router; - zfd.handle.fp = NULL; - zfd.free_filename = 0; - zfd.opened_path = NULL; - - zend_try { - zval *retval = NULL; - if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, &retval, 1, &zfd)) { - if (retval) { - decline = Z_TYPE_P(retval) == IS_BOOL && !Z_LVAL_P(retval); - zval_ptr_dtor(&retval); - } - } else { - decline = 1; + zend_file_handle zfd; + char *old_cwd; + + ALLOCA_FLAG(use_heap) + old_cwd = do_alloca(MAXPATHLEN, use_heap); + old_cwd[0] = '\0'; + php_ignore_value(VCWD_GETCWD(old_cwd, MAXPATHLEN - 1)); + + zfd.type = ZEND_HANDLE_FILENAME; + zfd.filename = server->router; + zfd.handle.fp = NULL; + zfd.free_filename = 0; + zfd.opened_path = NULL; + + zend_try { + zval *retval = NULL; + if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, &retval, 1, &zfd)) { + if (retval) { + decline = Z_TYPE_P(retval) == IS_BOOL && !Z_LVAL_P(retval); + zval_ptr_dtor(&retval); } - } zend_end_try(); - - if (old_cwd[0] != '\0') { - php_ignore_value(VCWD_CHDIR(old_cwd)); + } else { + decline = 1; } + } zend_end_try(); - free_alloca(old_cwd, use_heap); + if (old_cwd[0] != '\0') { + php_ignore_value(VCWD_CHDIR(old_cwd)); } + free_alloca(old_cwd, use_heap); + return decline; } /* }}} */ diff --git a/sapi/cli/tests/003-2.phpt b/sapi/cli/tests/003-2.phpt old mode 100755 new mode 100644 diff --git a/sapi/cli/tests/php_cli_server_011.phpt b/sapi/cli/tests/php_cli_server_011.phpt deleted file mode 100644 index a957a8ed4..000000000 --- a/sapi/cli/tests/php_cli_server_011.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -Bug #60180 ($_SERVER["PHP_SELF"] incorrect) ---SKIPIF-- - ---FILE-- - ---EXPECTF-- -okey diff --git a/sapi/cli/tests/php_cli_server_013.phpt b/sapi/cli/tests/php_cli_server_013.phpt index 18b7375b3..570798a88 100644 --- a/sapi/cli/tests/php_cli_server_013.phpt +++ b/sapi/cli/tests/php_cli_server_013.phpt @@ -33,7 +33,7 @@ HEADER } } -echo preg_replace("/", $output), "\n"; +echo preg_replace("/", $output), "\n"; fclose($fp); @@ -55,7 +55,7 @@ HEADER } } -echo preg_replace("/", $output), "\n"; +echo preg_replace("/", $output), "\n"; fclose($fp); $output = ''; @@ -76,7 +76,7 @@ HEADER } } -echo preg_replace("/", $output), "\n"; +echo preg_replace("/", $output), "\n"; fclose($fp); ?> --EXPECTF-- @@ -87,22 +87,22 @@ Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: %d -404 Not Found -

Not Found

The requested resource / was not found on this server.

+404 Not Found +

Not Found

The requested resource / was not found on this server.

HTTP/1.1 404 Not Found Host: %s Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: %d -404 Not Found -

Not Found

The requested resource /main/style.css was not found on this server.

+404 Not Found +

Not Found

The requested resource /main/style.css was not found on this server.

HTTP/1.1 404 Not Found Host: %s Connection: close Content-Type: text/html; charset=UTF-8 Content-Length: %d -404 Not Found -

Not Found

The requested resource /main/foo/bar was not found on this server.

+404 Not Found +

Not Found

The requested resource /main/foo/bar was not found on this server.

diff --git a/sapi/cli/tests/php_cli_server_014.phpt b/sapi/cli/tests/php_cli_server_014.phpt index 2eca8706b..f8a990561 100644 --- a/sapi/cli/tests/php_cli_server_014.phpt +++ b/sapi/cli/tests/php_cli_server_014.phpt @@ -57,7 +57,7 @@ HEADER } } -echo preg_replace("/", $output), "\n"; +echo preg_replace("/", $output), "\n"; fclose($fp); ?> @@ -76,5 +76,5 @@ Connection: close Content-Type: %s Content-Length: %d -404 Not Found -

Not Found

The requested resource /main/no-exists.php was not found on this server.

+404 Not Found +

Not Found

The requested resource /main/no-exists.php was not found on this server.

-- cgit v1.2.3