Skip to content

Commit

Permalink
Merge pull request #269 from laminas/2.59.x-merge-up-into-3.0.x_zUeexdGC
Browse files Browse the repository at this point in the history
Merge release 2.59.0 into 3.0.x
  • Loading branch information
gsteel committed Jun 19, 2024
2 parents b50325e + 31709ac commit 9f480f9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/book/v2/validators/csrf.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CSRF Validator

CAUTION: **Deprecated**
This validator is deprecated in favour of the drop-in replacement validator shipped in version 2.21.0 of [`laminas-session`](https://docs.laminas.dev/laminas-session/).
The validator here will be removed in version 3.0 of `laminas-validator`.

`Laminas\Validator\Csrf` provides the ability to both generate and validate CSRF tokens.
This allows you to validate if a form submission originated from the same site, by confirming the value of the CSRF field in the submitted form is the same as the one contained in the original form.

Expand Down
5 changes: 5 additions & 0 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,11 @@
</TooManyArguments>
</file>
<file src="src/ValidatorPluginManager.php">
<DeprecatedClass>
<code><![CDATA[Csrf::class]]></code>
<code><![CDATA[Csrf::class]]></code>
<code><![CDATA[Csrf::class]]></code>
</DeprecatedClass>
<DeprecatedMethod>
<code><![CDATA[getServiceLocator]]></code>
<code><![CDATA[getServiceLocator]]></code>
Expand Down
4 changes: 4 additions & 0 deletions src/Csrf.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
use function strtolower;
use function strtr;

/**
* @deprecated This validator will be removed in version 3.0 of this component. A replacement is available in
* version 2.21.0 of the laminas-session component: https://docs.laminas.dev/laminas-session/
*/
final class Csrf extends AbstractValidator
{
/**
Expand Down
5 changes: 5 additions & 0 deletions test/CsrfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
use function strtr;
use function uniqid;

/**
* @deprecated
*
* @psalm-suppress DeprecatedClass
*/
final class CsrfTest extends TestCase
{
private Csrf $validator;
Expand Down

0 comments on commit 9f480f9

Please sign in to comment.