1--TEST--
2openssl_encrypt() error tests
3--SKIPIF--
4<?php if (!extension_loaded("openssl")) print "skip"; ?>
5--FILE--
6<?php
7$data = "openssl_encrypt() tests";
8$method = "AES-128-CBC";
9$password = "openssl";
10$wrong = "wrong";
11$object = new stdclass;
12$arr = array(1);
13
14var_dump(openssl_encrypt($data, $wrong, $password));
15var_dump(openssl_encrypt($object, $method, $password));
16var_dump(openssl_encrypt($data, $object, $password));
17var_dump(openssl_encrypt($data, $method, $object));
18var_dump(openssl_encrypt($arr, $method, $object));
19var_dump(openssl_encrypt($data, $arr, $object));
20var_dump(openssl_encrypt($data, $method, $arr));
21?>
22--EXPECTF--
23Warning: openssl_encrypt(): Unknown cipher algorithm in %s on line %d
24bool(false)
25
26Warning: openssl_encrypt() expects parameter 1 to be string, object given in %s on line %d
27NULL
28
29Warning: openssl_encrypt() expects parameter 2 to be string, object given in %s on line %d
30NULL
31
32Warning: openssl_encrypt() expects parameter 3 to be string, object given in %s on line %d
33NULL
34
35Warning: openssl_encrypt() expects parameter 1 to be string, array given in %s on line %d
36NULL
37
38Warning: openssl_encrypt() expects parameter 2 to be string, array given in %s on line %d
39NULL
40
41Warning: openssl_encrypt() expects parameter 3 to be string, array given in %s on line %d
42NULL
43
44