1
0
mirror of https://github.com/php/php-src.git synced 2026-04-10 17:43:13 +02:00
Files
archived-php-src/ext/standard
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
..
2021-05-06 12:16:35 +02:00
2023-01-16 12:27:33 +01:00
2022-07-19 10:27:38 +01:00
2022-08-09 16:22:14 +02:00
2022-07-19 17:45:15 +02:00
2021-05-06 12:16:35 +02:00
2021-08-19 10:39:23 +02:00
2022-11-28 17:12:07 +01:00
2021-08-19 10:39:23 +02:00
2021-05-06 12:16:35 +02:00
2023-01-16 12:27:33 +01:00
2023-01-16 12:27:33 +01:00
2021-05-06 12:16:35 +02:00
2023-01-16 12:54:35 +00:00
2023-01-16 12:27:33 +01:00
2021-05-06 12:16:35 +02:00
2021-05-06 12:16:35 +02:00
2023-01-16 12:27:33 +01:00
2021-05-06 12:16:35 +02:00
2023-01-16 12:27:33 +01:00
2021-05-06 12:16:35 +02:00
2022-08-18 12:31:56 +02:00
2021-05-06 12:16:35 +02:00
2023-01-16 12:27:33 +01:00
2023-01-16 12:25:59 +01:00
2023-01-16 12:25:59 +01:00
2023-01-16 12:27:33 +01:00
2021-05-06 12:16:35 +02:00
2023-01-16 12:27:33 +01:00
2022-07-19 10:27:38 +01:00
2022-07-19 10:27:38 +01:00
2022-07-19 10:27:38 +01:00
2022-07-19 10:27:38 +01:00
2022-07-19 10:27:38 +01:00
2021-05-06 12:16:35 +02:00
2021-05-06 12:16:35 +02:00
2023-01-16 12:27:33 +01:00
2022-07-19 10:27:38 +01:00
2021-05-06 12:16:35 +02:00
2023-01-16 12:27:33 +01:00