Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:36635 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58490 invoked from network); 28 Mar 2008 00:49:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Mar 2008 00:49:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=chsc@peytz.dk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=chsc@peytz.dk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain peytz.dk from 80.160.174.174 cause and error) X-PHP-List-Original-Sender: chsc@peytz.dk X-Host-Fingerprint: 80.160.174.174 zimbra.peytz.dk Linux 2.5 (sometimes 2.4) (4) Received: from [80.160.174.174] ([80.160.174.174:53400] helo=zimbra.peytz.dk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 04/CB-27384-E804CE74 for ; Thu, 27 Mar 2008 19:49:20 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.peytz.dk (Postfix) with ESMTP id 4832415823C; Fri, 28 Mar 2008 01:49:16 +0100 (CET) X-Virus-Scanned: amavisd-new at X-Spam-Flag: NO X-Spam-Score: -2.339 X-Spam-Level: X-Spam-Status: No, score=-2.339 tagged_above=-10 required=5 tests=[AWL=0.160, BAYES_00=-2.599, RDNS_DYNAMIC=0.1] Received: from zimbra.peytz.dk ([127.0.0.1]) by localhost (zimbra.peytz.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xhLhUhmaN7uB; Fri, 28 Mar 2008 01:49:11 +0100 (CET) Received: from serber.tis.local (0x573d84a6.vbrnqu1.broadband.tele.dk [87.61.132.166]) by zimbra.peytz.dk (Postfix) with ESMTP id 8D562158026; Fri, 28 Mar 2008 01:49:11 +0100 (CET) Message-ID: <47EC4050.7090601@peytz.dk> Date: Fri, 28 Mar 2008 01:48:16 +0100 User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: internals@lists.php.net CC: ceo@l-i-e.com References: <47EC2065.2000002@peytz.dk> <41516.98.193.37.55.1206663621.squirrel@www.l-i-e.com> In-Reply-To: <41516.98.193.37.55.1206663621.squirrel@www.l-i-e.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] Allow unsetting headers previously set by header() From: chsc@peytz.dk (Christian Schmidt) Richard Lynch wrote: > At the risk of incurring the wrath of everybody else, I'd prefer to > see a new function like header_unset (or unset_header) to "undo" a > header. Currently header() supports adding, replacing and appending to existing headers as well as specifying the response status code, so I think that adding a header_unset() would break the current tradition. But I wouldn't object to adding a new function, though this is probably above by skills. > If a header was not set, and then you unset it, is that an error or > E_NOTICE or anything? No. I think that the current header() implementation relies on the reasonable assumption that the user don't need to know or care what headers are already set. For instance, by default existing headers are silently overwritten. > If you try to unset a header after the headers have gone out, > presumably the same nifty message about WHERE the header was set would > be output. Yes - the same error message is generated for header('Foo') and header('Foo: bar'). > But then to be truly pedantic, what if you unset a header that was > never set in the first place, after the headers have gone out? Is > this an error or any kind? Yes - header() always generates an error when called after the headers have gone out. This is analog to the current behaviour when setting a header that was already set. > Just trying to anticipate all the edge cases. :-) I appreciate that :-) I should probably add checks for these to the phpt. Christian