@@ -381,17 +381,15 @@ static const char *get_mime_type(const php_cli_server *server, const char *ext,
381
381
PHP_FUNCTION (apache_request_headers ) /* {{{ */
382
382
{
383
383
php_cli_server_client * client ;
384
- zval tmp ;
385
384
386
385
if (zend_parse_parameters_none () == FAILURE ) {
387
386
RETURN_THROWS ();
388
387
}
389
388
390
389
client = SG (server_context );
391
390
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 ));
395
393
}
396
394
/* }}} */
397
395
@@ -1624,6 +1622,7 @@ static void php_cli_server_client_save_header(php_cli_server_client *client)
1624
1622
ZVAL_STR (& tmp , client -> current_header_value );
1625
1623
/* strip off the colon */
1626
1624
zend_string * lc_header_name = zend_string_tolower_ex (client -> current_header_name , /* persistent */ true);
1625
+ GC_MAKE_PERSISTENT_LOCAL (lc_header_name );
1627
1626
1628
1627
/* Add the wrapped zend_string to the HashTable */
1629
1628
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
1660
1659
case HEADER_NONE :
1661
1660
/* Create new header field */
1662
1661
client -> current_header_name = zend_string_init (at , length , /* persistent */ true);
1662
+ GC_MAKE_PERSISTENT_LOCAL (client -> current_header_name );
1663
1663
break ;
1664
1664
case HEADER_FIELD : {
1665
1665
/* 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
1679
1679
case HEADER_FIELD :
1680
1680
/* Previous element was the header field, create the header value */
1681
1681
client -> current_header_value = zend_string_init (at , length , /* persistent */ true);
1682
+ GC_MAKE_PERSISTENT_LOCAL (client -> current_header_value );
1682
1683
break ;
1683
1684
case HEADER_VALUE : {
1684
1685
/* 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
1882
1883
zend_string * tmp_addr = NULL ;
1883
1884
php_network_populate_name_from_sockaddr (addr , addr_len , & tmp_addr , NULL , 0 );
1884
1885
client -> addr_str = zend_string_dup (tmp_addr , /* persistent */ true);
1886
+ GC_MAKE_PERSISTENT_LOCAL (client -> addr_str );
1885
1887
zend_string_release_ex (tmp_addr , /* persistent */ false);
1886
1888
1887
1889
php_http_parser_init (& client -> parser , PHP_HTTP_REQUEST );
0 commit comments