Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77112 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31591 invoked from network); 9 Sep 2014 14:53:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Sep 2014 14:53:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=are.you.winning@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=are.you.winning@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.49 as permitted sender) X-PHP-List-Original-Sender: are.you.winning@gmail.com X-Host-Fingerprint: 209.85.192.49 mail-qg0-f49.google.com Received: from [209.85.192.49] ([209.85.192.49:65053] helo=mail-qg0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 60/02-08634-0741F045 for ; Tue, 09 Sep 2014 10:53:36 -0400 Received: by mail-qg0-f49.google.com with SMTP id j5so4086786qga.8 for ; Tue, 09 Sep 2014 07:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=vznvfGD2k7TV+jO3AfiAjPei+7eNVEbhjoxkmZdv2K0=; b=L/VkHLlOACBfh4blW6jtjr60dyh6inzz7faHKywUnUEHDlkLD6wAp8EzXymrO9sYRt fkURd5DTeE1BOvESJ8ZLj3Y1p7KFI6bnUZPP9H30bKPRMDZaMWoI2pKAj61KV+DR5b9F Gh0Sm1OhwE2ulbQwdaXXoTfRcSCyIiuXQIdOqT+34okrv3zeERmBrSHX9cqoQ4trjRvv 3wAYYA8d16P2tsP761vWR7L9qen467iZIVb9jyhHB2TMqOHtWKCFArHDhnzzOZTkCkWV G0z8zVc0Z5FxrdaAPm+OEijsbMyF4AOE/v8MD5C0Y9XI38l6WbisiDMrDacEp6clyiwC TWQw== MIME-Version: 1.0 X-Received: by 10.229.232.1 with SMTP id js1mr51283076qcb.20.1410274413094; Tue, 09 Sep 2014 07:53:33 -0700 (PDT) Sender: are.you.winning@gmail.com Received: by 10.141.28.193 with HTTP; Tue, 9 Sep 2014 07:53:33 -0700 (PDT) In-Reply-To: References: Date: Tue, 9 Sep 2014 15:53:33 +0100 X-Google-Sender-Auth: vD5BLp4fXo0vi0PYFmt267roErc Message-ID: To: Ferenc Kovacs Cc: Sherif Ramadan , Tjerk Meesters , Florian Margaine , PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] setcookie() minor BC break - fixes issue #67736 From: cw@daverandom.com (Chris Wright) On 8 September 2014 09:09, Ferenc Kovacs wrote: > On Mon, Sep 8, 2014 at 9:15 AM, Sherif Ramadan > wrote: > >> Actually, we shouldn't be doing that all. We should simply just overwrit= e >> the header. It wouldn't make much sense to set two headers with the same >> cookie name when we can just overwrite it. >> >> >> > that would be a bigger BC break, and without a warning, those people > affected by the change will have a harder time figuring out what went wro= ng. > and as was discussed both in the PR and the bugreport the rfc discourages > but doesn't prohibit this behavior, so making it impossible for the > userland to do it would be a bit of an arbitrary restriction. > maybe we could do something like introducing a new $overwrite =3D true op= tion > to the function signature, but setcookie already has 7 arguments, so > probably isn't a great idea. How about changing the signature of setcookie() to: bool setcookie ( string $name [, string $value [, int $expire =3D 0 [, string $path [, string $domain [, int $flags =3D 0 [, bool $httponly =3D false ]]]]]]) And creating the following constants for use as flags: const COOKIE_SECURE =3D 1; const COOKIE_HTTPONLY =3D 2; const COOKIE_OVERWRITE =3D 4; This will also be a small BC break, but would potentially be a graceful way to trim an argument off setcookie() with minimal impact to users, making the signature more user-friendly (IMO) and allowing additional functionality to be added in the future by means of more flags. Setting the value of COOKIE_SECURE to 1 covers what I suspect will be the most common case where the value of this argument is not a bool or NULL, i.e. specifying 1/0 to reduce line length. If the $httponly arg is specified and not NULL it can override the value for that element of $flags. Passing this last argument could emit an E_DEPRECATED, either immediately or in the future. This is also not an ideal solution and everyone may hate it, just throwing it out there. Thanks, Chris > -- > Ferenc Kov=C3=A1cs > @Tyr43l - http://tyrael.hu