xref: /php-src/ext/openssl/tests/bug38255.phpt (revision 74859783)
1--TEST--
2openssl key from zval leaks
3--EXTENSIONS--
4openssl
5--FILE--
6<?php
7$pub_key_id = false;
8$signature = '';
9$ok = openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5);
10
11class test {
12    function __toString() {
13        return "test object";
14    }
15}
16$t = new test;
17
18
19var_dump(openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5));
20var_dump(openssl_verify("foo", $t, $pub_key_id, OPENSSL_ALGO_MD5));
21
22echo "Done\n";
23
24?>
25--EXPECTF--
26Warning: openssl_verify(): Supplied key param cannot be coerced into a public key in %s on line %d
27
28Warning: openssl_verify(): Supplied key param cannot be coerced into a public key in %s on line %d
29bool(false)
30
31Warning: openssl_verify(): Supplied key param cannot be coerced into a public key in %s on line %d
32bool(false)
33Done
34