mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix openssl_random_pseudo_bytes() always setting strong_result to true
This regressed in 62c7432f
, prior to that commit the value was set to
false in case random number generation failed, but now even if an
exception is thrown it is set to true. This likely does not _really_
matter as the user will handle the exception, still the value in
$strong_result is observable.
This commit is contained in:
parent
74720a22f3
commit
0dc600c69a
1 changed files with 5 additions and 7 deletions
|
@ -7961,17 +7961,15 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
|
||||||
RETURN_THROWS();
|
RETURN_THROWS();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zstrong_result_returned) {
|
|
||||||
ZEND_TRY_ASSIGN_REF_FALSE(zstrong_result_returned);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((buffer = php_openssl_random_pseudo_bytes(buffer_length))) {
|
if ((buffer = php_openssl_random_pseudo_bytes(buffer_length))) {
|
||||||
ZSTR_VAL(buffer)[buffer_length] = 0;
|
ZSTR_VAL(buffer)[buffer_length] = 0;
|
||||||
RETVAL_NEW_STR(buffer);
|
RETVAL_NEW_STR(buffer);
|
||||||
}
|
|
||||||
|
|
||||||
if (zstrong_result_returned) {
|
if (zstrong_result_returned) {
|
||||||
ZEND_TRY_ASSIGN_REF_TRUE(zstrong_result_returned);
|
ZEND_TRY_ASSIGN_REF_TRUE(zstrong_result_returned);
|
||||||
|
}
|
||||||
|
} else if (zstrong_result_returned) {
|
||||||
|
ZEND_TRY_ASSIGN_REF_FALSE(zstrong_result_returned);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue