File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -4472,17 +4472,15 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
4472
4472
RETURN_THROWS ();
4473
4473
}
4474
4474
4475
- if (zstrong_result_returned ) {
4476
- ZEND_TRY_ASSIGN_REF_FALSE (zstrong_result_returned );
4477
- }
4478
-
4479
4475
if ((buffer = php_openssl_random_pseudo_bytes (buffer_length ))) {
4480
4476
ZSTR_VAL (buffer )[buffer_length ] = 0 ;
4481
4477
RETVAL_NEW_STR (buffer );
4482
- }
4483
4478
4484
- if (zstrong_result_returned ) {
4485
- ZEND_TRY_ASSIGN_REF_TRUE (zstrong_result_returned );
4479
+ if (zstrong_result_returned ) {
4480
+ ZEND_TRY_ASSIGN_REF_TRUE (zstrong_result_returned );
4481
+ }
4482
+ } else if (zstrong_result_returned ) {
4483
+ ZEND_TRY_ASSIGN_REF_FALSE (zstrong_result_returned );
4486
4484
}
4487
4485
}
4488
4486
/* }}} */
Original file line number Diff line number Diff line change @@ -2123,11 +2123,10 @@ PHP_OPENSSL_API zend_string* php_openssl_random_pseudo_bytes(zend_long buffer_le
2123
2123
PHP_OPENSSL_CHECK_LONG_TO_INT_NULL_RETURN (buffer_length , length );
2124
2124
PHP_OPENSSL_RAND_ADD_TIME ();
2125
2125
if (RAND_bytes ((unsigned char * )ZSTR_VAL (buffer ), (int )buffer_length ) <= 0 ) {
2126
+ php_openssl_store_errors ();
2126
2127
zend_string_release_ex (buffer , 0 );
2127
2128
zend_throw_exception (zend_ce_exception , "Error reading from source device" , 0 );
2128
2129
return NULL ;
2129
- } else {
2130
- php_openssl_store_errors ();
2131
2130
}
2132
2131
2133
2132
return buffer ;
You can’t perform that action at this time.
0 commit comments