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)
44724472 RETURN_THROWS ();
44734473 }
44744474
4475- if (zstrong_result_returned ) {
4476- ZEND_TRY_ASSIGN_REF_FALSE (zstrong_result_returned );
4477- }
4478-
44794475 if ((buffer = php_openssl_random_pseudo_bytes (buffer_length ))) {
44804476 ZSTR_VAL (buffer )[buffer_length ] = 0 ;
44814477 RETVAL_NEW_STR (buffer );
4482- }
44834478
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 );
44864484 }
44874485}
44884486/* }}} */
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
21232123 PHP_OPENSSL_CHECK_LONG_TO_INT_NULL_RETURN (buffer_length , length );
21242124 PHP_OPENSSL_RAND_ADD_TIME ();
21252125 if (RAND_bytes ((unsigned char * )ZSTR_VAL (buffer ), (int )buffer_length ) <= 0 ) {
2126+ php_openssl_store_errors ();
21262127 zend_string_release_ex (buffer , 0 );
21272128 zend_throw_exception (zend_ce_exception , "Error reading from source device" , 0 );
21282129 return NULL ;
2129- } else {
2130- php_openssl_store_errors ();
21312130 }
21322131
21332132 return buffer ;
You can’t perform that action at this time.
0 commit comments