1--TEST--
2openssl_csr_new() tests
3--SKIPIF--
4<?php if (!extension_loaded("openssl")) print "skip"; ?>
5--FILE--
6<?php
7
8$a = 1;
9var_dump(openssl_csr_new(1,$a));
10var_dump(openssl_csr_new(1,$a,1,1));
11$a = array();
12
13$conf = array('config' => dirname(__FILE__) . DIRECTORY_SEPARATOR . 'openssl.cnf');
14var_dump(openssl_csr_new(array(), $a, $conf, array()));
15
16// this leaks
17$a = array(1,2);
18$b = array(1,2);
19var_dump(openssl_csr_new($a, $b, $conf));
20
21// options type check
22$x = openssl_pkey_new($conf);
23var_dump(openssl_csr_new(["countryName" => "DE"], $x, $conf + ["x509_extensions" => 0xDEADBEEF]));
24
25
26echo "Done\n";
27?>
28--EXPECTF--
29Warning: openssl_csr_new() expects parameter 1 to be array, integer given in %s on line %d
30NULL
31
32Warning: openssl_csr_new() expects parameter 1 to be array, integer given in %s on line %d
33NULL
34
35Warning: openssl_csr_new(): key array must be of the form array(0 => key, 1 => phrase) in %s on line %d
36
37Warning: 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
38bool(false)
39resource(%d) of type (OpenSSL X.509 CSR)
40resource(%d) of type (OpenSSL X.509 CSR)
41Done
42