xref: /PHP-7.2/ext/openssl/tests/bug38261.phpt (revision 17ccbeec)
1--TEST--
2openssl key from zval leaks
3--SKIPIF--
4<?php
5if (!extension_loaded("openssl")) die("skip");
6?>
7--FILE--
8<?php
9$cert = false;
10class test {
11    function __toString() {
12        return "test object";
13    }
14}
15$t = new test;
16
17var_dump(openssl_x509_parse("foo"));
18var_dump(openssl_x509_parse($t));
19var_dump(openssl_x509_parse(array()));
20var_dump(openssl_x509_parse());
21var_dump(openssl_x509_parse($cert));
22var_dump(openssl_x509_parse(new stdClass));
23
24?>
25--EXPECTF--
26bool(false)
27bool(false)
28bool(false)
29
30Warning: openssl_x509_parse() expects at least 1 parameter, 0 given in %sbug38261.php on line %d
31NULL
32bool(false)
33
34Recoverable fatal error: Object of class stdClass could not be converted to string in %sbug38261.php on line %d
35