Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'feature/i18n-filters-upd' of https://github.com/denixpo…
Browse files Browse the repository at this point in the history
…rt/zf2 into feature/i18n-filters
  • Loading branch information
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/SessionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@

namespace Zend\Session;

use Zend\EventManager\EventManagerInterface,
Zend\Session\SaveHandler\SaveHandlerInterface,
Zend\Validator\Alnum as AlnumValidator;
use Zend\EventManager\EventManagerInterface;
use Zend\Session\SaveHandler\SaveHandlerInterface;

/**
* Session ManagerInterface implementation utilizing ext/session
Expand Down Expand Up @@ -201,12 +200,15 @@ public function getName()
public function setName($name)
{
if ($this->sessionExists()) {
throw new Exception\InvalidArgumentException('Cannot set session name after a session has already started');
throw new Exception\InvalidArgumentException(
'Cannot set session name after a session has already started'
);
}

$validator = new AlnumValidator();
if (!$validator->isValid($name)) {
throw new Exception\InvalidArgumentException('Name provided contains invalid characters; must be alphanumeric only');
if (!preg_match('/^[a-zA-Z0-9]+$/', $name)) {
throw new Exception\InvalidArgumentException(
'Name provided contains invalid characters; must be alphanumeric only'
);
}

$this->name = $name;
Expand Down

0 comments on commit 4efb47c

Please sign in to comment.