File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -117,16 +117,15 @@ PHP_FUNCTION(header_register_callback)
117117
118118 if (ZEND_FCC_INITIALIZED (SG (send_header_fcc ))) {
119119 zend_fcc_dtor (& SG (send_header_fcc ));
120- SG (send_header_fcc ) = empty_fcall_info_cache ;
121120 }
122121
123122 /* Don't store callback if headers have already been sent:
124123 * It won't get used and we won't have a chance to release it. */
125124 if (UNEXPECTED (SG (headers_sent ))) {
126125 zend_release_fcall_info_cache (& fcc );
126+ } else {
127+ zend_fcc_dup (& SG (send_header_fcc ), & fcc );
127128 }
128-
129- zend_fcc_dup (& SG (send_header_fcc ), & fcc );
130129 RETURN_TRUE ;
131130}
132131/* }}} */
Original file line number Diff line number Diff line change 1+ --TEST--
2+ Test header_register_callback
3+ --FILE--
4+ <?php
5+ class TrampolineTest {
6+ public function __call (string $ name , array $ arguments ) {
7+ echo 'Trampoline for ' , $ name , PHP_EOL ;
8+ }
9+ }
10+ $ o = new TrampolineTest ();
11+ $ callback = [$ o , 'trampoline ' ];
12+
13+ echo "Send headers. \n" ;
14+ header_register_callback ($ callback );
15+ ?>
16+ --EXPECT--
17+ Send headers.
You can’t perform that action at this time.
0 commit comments