<commit_before><?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

/**
 * opSecurityUser will handle credential for OpenPNE.
 *
 * @package    OpenPNE
 * @subpackage user
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 */
class opSecurityUser extends opAdaptableUser
{
  protected
    $authAdapters = array(),
    $serializedMember = '';

  /**
   * Initializes the current user.
   *
   * @see sfBasicSecurityUser
   */
  public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $options = array())
  {
    parent::initialize($dispatcher, $storage, $options);

    $this->initializeUserStatus();
  }

  public function clearSessionData()
  {
    parent::clearSessionData();

    // remove member cache
    $this->serializedMember = '';
  }

  public function getMemberId($inactive = false)
  {
    return $this->getMember($inactive)->getId();
  }

  public function setMemberId($memberId)
  {
    $this->serializedMember = null;

    return $this->setAttribute('member_id', $memberId, 'opSecurityUser');
  }

  /**
   * Get Member object. This method always return object.
   *
   * @param  bool $inactive If true then use Member::findInactive(), otherwise use Member::find().
   * @return Member or opAnonymousMember
   */
  public function getMember($inactive = false)
  {
    // get memberId from session storage
    $memberId = $this->getAttribute('member_id', null, 'opSecurityUser');

    if (!$memberId)
    {
      return new opAnonymousMember();
    }

    if ($inactive)<commit_msg>use empty string to clear member cache (fixes #3497 BP from #3416) (cherry picked from commit eb5fe39f5619e7bcac973ca61bd32a94bfa28090)<commit_after><?php

/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */

/**
 * opSecurityUser will handle credential for OpenPNE.
 *
 * @package    OpenPNE
 * @subpackage user
 * @author     <NAME> <<EMAIL>>
 * @author     <NAME> <<EMAIL>>
 */
class opSecurityUser extends opAdaptableUser
{
  protected
    $authAdapters = array(),
    $serializedMember = '';

  /**
   * Initializes the current user.
   *
   * @see sfBasicSecurityUser
   */
  public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $options = array())
  {
    parent::initialize($dispatcher, $storage, $options);

    $this->initializeUserStatus();
  }

  public function clearSessionData()
  {
    parent::clearSessionData();

    // remove member cache
    $this->serializedMember = '';
  }

  public function getMemberId($inactive = false)
  {
    return $this->getMember($inactive)->getId();
  }

  public function setMemberId($memberId)
  {
    $this->serializedMember = '';

    return $this->setAttribute('member_id', $memberId, 'opSecurityUser');
  }

  /**
   * Get Member object. This method always return object.
   *
   * @param  bool $inactive If true then use Member::findInactive(), otherwise use Member::find().
   * @return Member or opAnonymousMember
   */
  public function getMember($inactive = false)
  {
    // get memberId from session storage
    $memberId = $this->getAttribute('member_id', null, 'opSecurityUser');

    if (!$memberId)
    {
      return new opAnonymousMember();
    }

    if ($inactive)
{'fraction_non_alphanumeric': 0.1245136186770428, 'fraction_numerical': 0.008337965536409116, 'mean_word_length': 3.4931335830212236, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5608448', 'n_tokens_mistral': 1097, 'n_tokens_neox': 1059, 'n_words': 302}