Add alternative setcookie() signature (#609)

* Add alternative setcookie() signature

* Mute parameter mismatch failures for setcookie & setrawcookie functions
This commit is contained in:
Anatoly Pashin 2019-06-18 02:23:01 +10:00 committed by Aleksander
parent 6c7fa404b0
commit c7b26803bb
2 changed files with 58 additions and 1 deletions

View File

@ -611,6 +611,29 @@ function restore_include_path () {}
*/
function setcookie ($name, $value = "", $expire = 0, $path = "", $domain = "", $secure = false, $httponly = false) {}
/**
* Send a cookie
*
* @link https://php.net/manual/en/function.setcookie.php
*
* @param string $name The name of the cookie.
* @param string $value [optional] The value of the cookie. This value is stored on the clients
* computer; do not store sensitive information.
* Assuming the name is 'cookiename', this value is retrieved through $_COOKIE['cookiename']
* @param array $options [optional] An associative array which may have any of the keys expires, path, domain, secure,
* httponly and samesite. The values have the same meaning as described for the parameters with
* the same name. The value of the samesite element should be either Lax or Strict.
* If any of the allowed options are not given, their default values are the same
* as the default values of the explicit parameters. If the samesite element is omitted,
* no SameSite cookie attribute is set.
*
* @return bool If output exists prior to calling this function, setcookie will fail and return false. If
* setcookie successfully runs, it will return true.
* This does not indicate whether the user accepted the cookie.
* @since 7.3
*/
function setcookie($name, $value = '', array $options = []) {}
/**
* Send a cookie without urlencoding the cookie value
* @link https://php.net/manual/en/function.setrawcookie.php
@ -624,7 +647,29 @@ function setcookie ($name, $value = "", $expire = 0, $path = "", $domain = "", $
* @return bool true on success or false on failure.
* @since 5.0
*/
function setrawcookie ($name, $value = null, $expire = 0, $path = "", $domain = "", $secure = false, $httponly = false) {}
function setrawcookie ($name, $value = '', $expire = 0, $path = "", $domain = "", $secure = false, $httponly = false) {}
/**
* Send a cookie without urlencoding the cookie value
*
* @link https://php.net/manual/en/function.setrawcookie.php
*
* @param string $name The name of the cookie.
* @param string $value [optional] The value of the cookie. This value is stored on the clients
* computer; do not store sensitive information.
* Assuming the name is 'cookiename', this value is retrieved through $_COOKIE['cookiename']
* @param array $options [optional] An associative array which may have any of the keys expires, path, domain, secure,
* httponly and samesite. The values have the same meaning as described for the parameters with
* the same name. The value of the samesite element should be either Lax or Strict.
* If any of the allowed options are not given, their default values are the same
* as the default values of the explicit parameters. If the samesite element is omitted,
* no SameSite cookie attribute is set.
*
* @return bool If output exists prior to calling this function, setcookie will fail and return false. If
* setcookie successfully runs, it will return true.
* This does not indicate whether the user accepted the cookie.
*/
function setrawcookie ($name, $value = '', array $options = []) {}
/**
* Send a raw HTTP header

View File

@ -986,6 +986,18 @@
"parameter mismatch"
]
},
{
"name":"setcookie",
"problems": [
"parameter mismatch"
]
},
{
"name":"setrawcookie",
"problems": [
"parameter mismatch"
]
},
{
"name":"sodium_memzero",
"problems": [