Skip to content

Commit c2cebfa

Browse files
committed
Fix code via suggestion from Niels
1 parent 3890b48 commit c2cebfa

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ext/standard/basic_functions.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,9 @@ PHP_RINIT_FUNCTION(basic) /* {{{ */
421421
BASIC_RINIT_SUBMODULE(dir)
422422
BASIC_RINIT_SUBMODULE(url_scanner_ex)
423423

424+
/* Initialize memory for last http headers */
425+
ZVAL_UNDEF(&BG(last_http_headers));
426+
424427
/* Setup default context */
425428
FG(default_context) = NULL;
426429

@@ -485,6 +488,9 @@ PHP_RSHUTDOWN_FUNCTION(basic) /* {{{ */
485488
BASIC_RSHUTDOWN_SUBMODULE(user_filters)
486489
BASIC_RSHUTDOWN_SUBMODULE(browscap)
487490

491+
/* Free last http headers */
492+
zval_ptr_dtor(&BG(last_http_headers));
493+
488494
BG(page_uid) = -1;
489495
BG(page_gid) = -1;
490496
return SUCCESS;

ext/standard/http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,6 @@ PHP_FUNCTION(http_last_response_header)
242242
zend_parse_parameters_none();
243243

244244
if (!Z_ISUNDEF(BG(last_http_headers))) {
245-
ZVAL_DUP(return_value, &BG(last_http_headers));
245+
ZVAL_COPY(return_value, &BG(last_http_headers));
246246
}
247247
}

0 commit comments

Comments
 (0)