Skip to content

Commit

Permalink
Fixed bug #78391
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Aug 9, 2019
1 parent b2044cd commit 69a7713
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions NEWS
Expand Up @@ -6,6 +6,10 @@ PHP NEWS
. Fixed bug #78383 (Casting a DateTime to array no longer returns its
properties). (Nikita)

- OpenSSL:
. Fixed bug #78391 (Assertion failure in openssl_random_pseudo_bytes).
(Nikita)

08 Aug 2019, PHP 7.4.0beta2

- Core:
Expand Down
2 changes: 1 addition & 1 deletion ext/openssl/openssl.c
Expand Up @@ -6974,7 +6974,7 @@ PHP_FUNCTION(openssl_random_pseudo_bytes)
zend_long buffer_length;
zval *zstrong_result_returned = NULL;

if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|z/", &buffer_length, &zstrong_result_returned) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|z", &buffer_length, &zstrong_result_returned) == FAILURE) {
return;
}

Expand Down
13 changes: 13 additions & 0 deletions ext/openssl/tests/bug78391.phpt
@@ -0,0 +1,13 @@
--TEST--
Bug #78391: Assertion failure in openssl_random_pseudo_bytes
--FILE--
<?php

$isStrongCrypto = false;
var_dump(strlen(openssl_random_pseudo_bytes(16, $isStrongCrypto)));
var_dump($isStrongCrypto);

?>
--EXPECT--
int(16)
bool(true)

0 comments on commit 69a7713

Please sign in to comment.