Skip to content

Commit 85cd379

Browse files
committed
Fix RC Debug
1 parent 3e7cf1a commit 85cd379

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sapi/cli/php_cli_server.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,17 +381,15 @@ static const char *get_mime_type(const php_cli_server *server, const char *ext,
381381
PHP_FUNCTION(apache_request_headers) /* {{{ */
382382
{
383383
php_cli_server_client *client;
384-
zval tmp;
385384

386385
if (zend_parse_parameters_none() == FAILURE) {
387386
RETURN_THROWS();
388387
}
389388

390389
client = SG(server_context);
391390

392-
/* Need to copy the HashTable */
393-
ZVAL_ARR(&tmp,&client->request.headers_original_case);
394-
RETURN_COPY(&tmp);
391+
/* Need to duplicate the header HashTable */
392+
RETURN_ARR(zend_array_dup(&client->request.headers_original_case));
395393
}
396394
/* }}} */
397395

@@ -1624,6 +1622,7 @@ static void php_cli_server_client_save_header(php_cli_server_client *client)
16241622
ZVAL_STR(&tmp, client->current_header_value);
16251623
/* strip off the colon */
16261624
zend_string *lc_header_name = zend_string_tolower_ex(client->current_header_name, /* persistent */ true);
1625+
GC_MAKE_PERSISTENT_LOCAL(lc_header_name);
16271626

16281627
/* Add the wrapped zend_string to the HashTable */
16291628
zend_hash_add(&client->request.headers, lc_header_name, &tmp);
@@ -1660,6 +1659,7 @@ static int php_cli_server_client_read_request_on_header_field(php_http_parser *p
16601659
case HEADER_NONE:
16611660
/* Create new header field */
16621661
client->current_header_name = zend_string_init(at, length, /* persistent */ true);
1662+
GC_MAKE_PERSISTENT_LOCAL(client->current_header_name);
16631663
break;
16641664
case HEADER_FIELD: {
16651665
/* Append header name to the previous value of it */
@@ -1679,6 +1679,7 @@ static int php_cli_server_client_read_request_on_header_value(php_http_parser *p
16791679
case HEADER_FIELD:
16801680
/* Previous element was the header field, create the header value */
16811681
client->current_header_value = zend_string_init(at, length, /* persistent */ true);
1682+
GC_MAKE_PERSISTENT_LOCAL(client->current_header_value);
16821683
break;
16831684
case HEADER_VALUE: {
16841685
/* Append header value to the previous value of it */
@@ -1882,6 +1883,7 @@ static void php_cli_server_client_ctor(php_cli_server_client *client, php_cli_se
18821883
zend_string *tmp_addr = NULL;
18831884
php_network_populate_name_from_sockaddr(addr, addr_len, &tmp_addr, NULL, 0);
18841885
client->addr_str = zend_string_dup(tmp_addr, /* persistent */ true);
1886+
GC_MAKE_PERSISTENT_LOCAL(client->addr_str);
18851887
zend_string_release_ex(tmp_addr, /* persistent */ false);
18861888

18871889
php_http_parser_init(&client->parser, PHP_HTTP_REQUEST);

0 commit comments

Comments
 (0)