]> granicus.if.org Git - php/commit
Add header_register_callback(), allows a userland function
authorScott MacVicar <scottmac@php.net>
Thu, 3 Feb 2011 16:47:28 +0000 (16:47 +0000)
committerScott MacVicar <scottmac@php.net>
Thu, 3 Feb 2011 16:47:28 +0000 (16:47 +0000)
commitca378eefa042647892a9e7bb8f9e6da907207e70
tree8cdb083322eb2f7cca842f0296fbfce38bb27ee9
parentee9af39c901068e2b253ca3c9c6ef9ca7b932957
Add header_register_callback(), allows a userland function
to be called as all the headers are being sent and after all
of the default headers have been merged.

headers_list(), header_remove() and header() can all be used
inside the callback.

<?php

header('Content-Type: text/plain');
header('X-Test: foo');

function foo() {
  foreach (headers_list() as $header) {
    if (strpos($header, 'X-Powered') !== false) {
      header_remove('X-Powered-By');
    }
    header_remove('X-Test');
  }
}

$result = header_register_callback('foo');
echo "a";
NEWS
ext/standard/basic_functions.c
ext/standard/basic_functions.h
main/SAPI.c
main/SAPI.h