1
0
mirror of https://github.com/php/php-src.git synced 2026-04-10 09:33:06 +02:00
Files
archived-php-src/ext
Tim Düsterhus c59e0750af password: Use php_random_bytes_throw in php_password_make_salt (#10393)
The CSPRNG failing should be rare nowadays, but it *might* happen and without
this patch it's hard for the user to find out why the salt generation failed:
The error message is not actionable.

This patch will automatically set the CSPRNG exception to the `$previous`
exception of the ValueError that is thrown, allowing the developer to determine
the cause of the salt generation failure.

Before:

    Fatal error: Uncaught ValueError: Unable to generate salt in php-src/test3.php:3
    Stack trace:
    #0 php-src/test3.php(3): password_hash(Object(SensitiveParameterValue), '2y')
    #1 {main}
      thrown in php-src/test3.php on line 3

After:

    Fatal error: Uncaught Random\RandomException: Cannot open /dev/urandom: No such file or directory in php-src/test3.php:3
    Stack trace:
    #0 php-src/test3.php(3): password_hash(Object(SensitiveParameterValue), '2y')
    #1 {main}

    Next ValueError: Unable to generate salt in php-src/test3.php:3
    Stack trace:
    #0 php-src/test3.php(3): password_hash(Object(SensitiveParameterValue), '2y')
    #1 {main}
      thrown in php-src/test3.php on line 3
2023-01-23 18:35:16 +01:00
..
2022-10-27 14:42:17 +01:00
2023-01-19 18:49:54 +00:00
2023-01-23 13:46:58 +00:00
2022-09-07 17:41:10 +02:00
2023-01-23 13:46:58 +00:00
2022-10-27 14:42:40 +01:00
2023-01-23 13:46:58 +00:00
2023-01-16 12:27:33 +01:00
2023-01-23 13:46:58 +00:00
2022-09-06 10:42:34 +01:00
2023-01-23 13:46:58 +00:00
2023-01-23 13:51:26 +00:00
2022-11-30 12:13:36 +01:00
2022-10-19 11:37:30 +02:00
2023-01-16 12:27:33 +01:00
2022-12-19 16:17:02 +01:00
2023-01-16 12:27:33 +01:00
2022-09-07 17:41:10 +02:00
2023-01-23 13:46:58 +00:00
2023-01-19 09:06:39 +01:00
2022-10-27 14:42:40 +01:00
2023-01-15 15:43:57 +00:00