summaryrefslogtreecommitdiff
path: root/sapi/cli/php_cli_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/cli/php_cli_server.c')
-rw-r--r--sapi/cli/php_cli_server.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 4fe975d6a4..6511e08c9a 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1123,7 +1123,7 @@ static void php_cli_server_log_response(php_cli_server_client *client, int statu
{
int color = 0, effective_status = status;
char *basic_buf, *message_buf = "", *error_buf = "";
- zend_bool append_error_message = 0;
+ bool append_error_message = 0;
if (PG(last_error_message)) {
if (PG(last_error_type) & E_FATAL_ERRORS) {
@@ -1821,12 +1821,8 @@ static size_t php_cli_server_client_send_through(php_cli_server_client *client,
int nfds = php_pollfd_for(client->sock, POLLOUT, &tv);
if (nfds > 0) {
continue;
- } else if (nfds < 0) {
- /* error */
- php_handle_aborted_connection();
- return nbytes_left;
} else {
- /* timeout */
+ /* error or timeout */
php_handle_aborted_connection();
return nbytes_left;
}
@@ -2019,9 +2015,11 @@ static int php_cli_server_dispatch_script(php_cli_server *server, php_cli_server
{
zend_file_handle zfd;
zend_stream_init_filename(&zfd, SG(request_info).path_translated);
+ zfd.primary_script = 1;
zend_try {
php_execute_script(&zfd);
} zend_end_try();
+ zend_destroy_file_handle(&zfd);
}
php_cli_server_log_response(client, SG(sapi_headers).http_response_code, NULL);
@@ -2140,6 +2138,7 @@ static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server
php_ignore_value(VCWD_GETCWD(old_cwd, MAXPATHLEN - 1));
zend_stream_init_filename(&zfd, server->router);
+ zfd.primary_script = 1;
zend_try {
zval retval;
@@ -2153,6 +2152,8 @@ static int php_cli_server_dispatch_router(php_cli_server *server, php_cli_server
}
} zend_end_try();
+ zend_destroy_file_handle(&zfd);
+
if (old_cwd[0] != '\0') {
php_ignore_value(VCWD_CHDIR(old_cwd));
}
@@ -2736,7 +2737,7 @@ int do_cli_server(int argc, char **argv) /* {{{ */
sapi_module.phpinfo_as_text = 0;
{
- zend_bool ipv6 = strchr(server.host, ':');
+ bool ipv6 = strchr(server.host, ':');
php_cli_server_logf(
PHP_CLI_SERVER_LOG_PROCESS,
"PHP %s Development Server (http://%s%s%s:%d) started",