Skip to content

Commit 946c5c2

Browse files
committed
Added note about the hash_equals polyfill
1 parent 3b2f4d0 commit 946c5c2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cookbook/security/custom_authentication_provider.rst

+13
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,18 @@ the ``PasswordDigest`` header value matches with the user's password.
289289
provider for the given token. In the case of multiple providers, the
290290
authentication manager will then move to the next provider in the list.
291291

292+
.. note::
293+
294+
While the :phpfunction:`hash_equals` function was introduced in PHP 5.6,
295+
you are safe to use it with any PHP version in your Symfony application. In
296+
PHP versions prior to 5.6, `Symfony Polyfill`_ (which is included in
297+
Symfony) will define the function for you.
298+
299+
.. versionadded:: 2.8
300+
Symfony Polyfill is included by default since Symfony 2.8. Prior to Symfony 2.8,
301+
you have to execute ``composer require symfony/polyfill-php56`` to be able to
302+
use ``hash_equals`` on older PHP versions.
303+
292304
The Factory
293305
-----------
294306

@@ -666,3 +678,4 @@ in the factory and consumed or passed to the other classes in the container.
666678
.. _`WSSE`: http://www.xml.com/pub/a/2003/12/17/dive.html
667679
.. _`nonce`: https://en.wikipedia.org/wiki/Cryptographic_nonce
668680
.. _`timing attacks`: https://en.wikipedia.org/wiki/Timing_attack
681+
.. _`Symfony Polyfill`: https://github.com/symfony/polyfill

0 commit comments

Comments
 (0)