1--TEST--
2openssl_pkcs12_export_to_file() error tests
3--EXTENSIONS--
4openssl
5--FILE--
6<?php
7$pkcsfile = __DIR__ . "/openssl_pkcs12_export_to_file__pkcsfile.tmp";
8
9$cert_file = __DIR__ . "/public.crt";
10$cert = file_get_contents($cert_file);
11$cert_path = "file://" . $cert_file;
12$priv_file = __DIR__ . "/private.crt";
13$priv = file_get_contents($priv_file);
14$wrong_priv_file = __DIR__ . "/private_rsa_1024.key";
15$wrong_priv = file_get_contents($wrong_priv_file);
16$pass = 'test';
17
18var_dump(openssl_pkcs12_export_to_file($cert, $pkcsfile, null, $pass));
19var_dump(openssl_pkcs12_export_to_file($cert, $pkcsfile, $wrong_priv, $pass));
20var_dump(openssl_pkcs12_export_to_file($cert, '.', $priv, $pass));
21?>
22--CLEAN--
23<?php
24$pkcsfile = __DIR__ . "/openssl_pkcs12_export_to_file__pkcsfile.tmp";
25if (file_exists($pkcsfile)) {
26    unlink($pkcsfile);
27}
28?>
29--EXPECTF--
30Warning: openssl_pkcs12_export_to_file(): Cannot get private key from parameter 3 in %s on line %d
31bool(false)
32
33Warning: openssl_pkcs12_export_to_file(): Private key does not correspond to cert in %s on line %d
34bool(false)
35
36Warning: openssl_pkcs12_export_to_file(): Error opening file %s in %s on line %d
37bool(false)
38