xref: /PHP-5.4/ext/openssl/tests/003.phpt (revision 82167472)
1--TEST--
2openssl_pkcs7_decrypt() and invalid parameters
3--SKIPIF--
4<?php if (!extension_loaded("openssl")) print "skip"; ?>
5--FILE--
6<?php
7
8function myErrorHandler($errno, $errstr, $errfile, $errline) {
9var_dump($errstr);
10}
11set_error_handler("myErrorHandler");
12
13$a = 1;
14$b = 1;
15$c = new stdclass;
16$d = new stdclass;
17
18var_dump(openssl_pkcs7_decrypt($a, $b, $c, $d));
19var_dump($c);
20
21var_dump(openssl_pkcs7_decrypt($b, $b, $b, $b));
22var_dump(openssl_pkcs7_decrypt($a, $b, "", ""));
23var_dump(openssl_pkcs7_decrypt($a, $b, true, false));
24var_dump(openssl_pkcs7_decrypt($a, $b, 0, 0));
25
26echo "Done\n";
27?>
28--EXPECTF--
29string(57) "Object of class stdClass could not be converted to string"
30string(45) "Object of class stdClass to string conversion"
31string(66) "openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert"
32bool(false)
33object(stdClass)#1 (0) {
34}
35string(66) "openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert"
36bool(false)
37string(66) "openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert"
38bool(false)
39string(66) "openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert"
40bool(false)
41string(66) "openssl_pkcs7_decrypt(): unable to coerce parameter 3 to x509 cert"
42bool(false)
43Done
44