Bug #76906 [Sus->Nab]: setcookie() doesn't handle "samesite" attribute while the RFC says it should

From: Date: Thu, 20 Sep 2018 20:10:47 +0000
Subject: Bug #76906 [Sus->Nab]: setcookie() doesn't handle "samesite" attribute while the RFC says it should
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217159@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76906&edit=1

 ID:                 76906
 Updated by:         requinix@php.net
 Reported by:        nicolas dot grekas+php at gmail dot com
 Summary:            setcookie() doesn't handle "samesite" attribute
                     while the RFC says it should
-Status:             Suspended
+Status:             Not a bug
 Type:               Bug
 Package:            Scripting Engine problem
 PHP Version:        7.3.0RC1
 Block user comment: N
 Private report:     N

 New Comment:

Covered in the new errata section, and the docs will show the 3-parameter syntax.
https://wiki.php.net/rfc/same-site-cookie#errata
http://svn.php.net/viewvc?view=revision&revision=345661


Previous Comments:
------------------------------------------------------------------------
[2018-09-19 21:28:03] requinix@php.net

The expires argument was moved into the array, making the array argument be the third position.
  setcookie('b', 'a', array());

While there was some discussion about this happening, I'm not convinced there was a conclusion
reached. Want to bring it up on the internals list?

------------------------------------------------------------------------
[2018-09-19 20:58:26] nicolas dot grekas+php at gmail dot com

Description:
------------
Per https://wiki.php.net/rfc/same-site-cookie
setcookie should accept a 4th "array $options" argument.
But this doesn't work.
I didn't check the other function mentioned in the RFC so they might have the same issue.

Test script:
---------------
<?php

setcookie('b', 'a', 0, array());
setcookie('b', 'a', 0, '/', '', false, false,
'lax');

See https://3v4l.org/52qe6

Expected result:
----------------
Warning: setcookie() expects at most 7 parameters, 8 given in /in/52qe6 on line 4

Actual result:
--------------
Warning: setcookie() expects parameter 4 to be string, array given in /in/52qe6 on line 3 Warning:
setcookie() expects at most 7 parameters, 8 given in /in/52qe6 on line 4


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=76906&edit=1


Thread (3 messages)

« previous php.bugs (#217159) next »