Skip to content

Commit

Permalink
User::setExpiration() changed arguments (BC break)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 25, 2017
1 parent e042f88 commit 84ada18
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Security/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,19 @@ public function getAuthenticator($throw = TRUE)
/**
* Enables log out after inactivity.
* @param string|int|\DateTimeInterface number of seconds or timestamp
* @param int|bool flag IUserStorage::CLEAR_IDENTITY
* @param bool clear the identity from persistent storage? (deprecated)
* @param int flag IUserStorage::CLEAR_IDENTITY
* @return static
*/
public function setExpiration($time, $flags = NULL, $clearIdentity = FALSE)
public function setExpiration($time, $flags = 0)
{
$clearIdentity = $clearIdentity || $flags === IUserStorage::CLEAR_IDENTITY;
$clearIdentity = $flags === IUserStorage::CLEAR_IDENTITY;
if (is_bool($flags)) {
trigger_error(__METHOD__ . '() second parameter $whenBrowserIsClosed was removed.', E_USER_DEPRECATED);
}
if (func_num_args() > 2) {
$clearIdentity = $clearIdentity || func_get_arg(2);
trigger_error(__METHOD__ . '() third parameter is deprecated, use flag setExpiration($time, IUserStorage::CLEAR_IDENTITY)', E_USER_DEPRECATED);
}
$this->storage->setExpiration($time, $clearIdentity ? IUserStorage::CLEAR_IDENTITY : 0);
return $this;
}
Expand Down

0 comments on commit 84ada18

Please sign in to comment.