1--TEST--
2openssl_csr_new() tests
3--EXTENSIONS--
4openssl
5--FILE--
6<?php
7
8$a = array();
9
10$conf = array('config' => __DIR__ . DIRECTORY_SEPARATOR . 'openssl.cnf');
11
12try {
13    var_dump(openssl_csr_new(array(), $a, $conf, array()));
14    var_dump($keyFailed);
15} catch (\ValueError $e) {
16    echo $e->getMessage() . \PHP_EOL;
17}
18
19// this leaks
20$a = array(1,2);
21$b = array(1,2);
22var_dump(openssl_csr_new($a, $b, $conf));
23
24// options type check
25$x = openssl_pkey_new($conf);
26var_dump(openssl_csr_new(["countryName" => "DE"], $x, $conf + ["x509_extensions" => 0xDEADBEEF]));
27
28?>
29--EXPECTF--
30Warning: openssl_csr_new(): add1_attr_by_txt challengePassword_min -> 4 (failed; check error queue and value of string_mask OpenSSL option if illegal characters are reported) in %s on line %d
31Key array must be of the form array(0 => key, 1 => phrase)
32object(OpenSSLCertificateSigningRequest)#%d (0) {
33}
34object(OpenSSLCertificateSigningRequest)#%d (0) {
35}
36