-
-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added workaround for phalcon/cphalcon#14346
- Loading branch information
1 parent
cc40e41
commit fbdb344
Showing
3 changed files
with
70 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Phalcon; | ||
|
||
use function Vokuro\container; | ||
|
||
/** | ||
* Extended class for fixing phalcon/cphalcon#14346 issue | ||
* | ||
* @see https://github.com/phalcon/cphalcon/pull/14347 | ||
*/ | ||
class Beta2FixSecurity extends Security | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getRequestToken(): string | ||
{ | ||
if (empty($this->requestToken)) { | ||
return $this->getSessionToken(); | ||
} | ||
|
||
return (string) $this->requestToken; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
* | ||
* @return string | ||
* @throws Exception | ||
*/ | ||
public function getSessionToken(): string | ||
{ | ||
if (!container()->has('session')) { | ||
throw new Exception( | ||
Exception::containerServiceNotFound("the 'session' service") | ||
); | ||
} | ||
|
||
$session = container()->getShared('session'); | ||
return (string) $session->get($this->tokenValueSessionId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters