Changeset 786 for trunk


Ignore:
Timestamp:
Mar 14, 2023 7:01:46 PM (14 months ago)
Author:
anonymous
Message:

Fix App::unsetCookie() to match args to setCookie().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/App.inc.php

    r785 r786  
    18371837
    18381838    /*
    1839     * Delete a cookie previously created by setCookie().
     1839    * Delete a cookie previously created by setCookie(). The same function arguments must be used to unset a cookie as were used to set it.
    18401840    *
    18411841    * @access   public
    18421842    * @param    string  $name       The name of the cookie.
     1843    * @param    string  $path       The path on the server in which the cookie will be available on.
     1844    * @param    string  $domain     The domain that the cookie is available to.
     1845    * @param    bool    $secure     Indicates that the cookie should only be transmitted over a secure HTTPS connection from the client.
     1846    * @param    bool    $httponly   When TRUE the cookie will be made accessible only through the HTTP protocol (makes cookies unreadable to javascript).
     1847    * @param    string  $samesite   Value of the SameSite key ('None', 'Lax', or 'Strict'). PHP 7.3+ only.
    18431848    * @return   bool                True on success, false on error.
    18441849    * @author   Quinn Comendant <quinn@strangecode.com>
    18451850    * @since    14 Mar 2023 12:12:15
    18461851    */
    1847     public function unsetCookie($name)
    1848     {
    1849         $ret = setcookie($name, '', 1);
    1850         if (false === $ret) {
    1851             $this->logMsg(sprintf('Failed to unset cookie (%s) probably due to output before headers.', $name), LOG_NOTICE, __FILE__, __LINE__);
    1852         }
    1853         return $ret;
     1852    public function unsetCookie($name, $path='/', $domain=null, $secure=null, $httponly=null, $samesite=null)
     1853    {
     1854        return $this->setCookie($name, '', 1, $path, $domain, $secure, $httponly, $samesite);
    18541855    }
    18551856
Note: See TracChangeset for help on using the changeset viewer.