1--TEST--
2php_openssl_pkey_from_zval memory leak
3--EXTENSIONS--
4openssl
5--FILE--
6<?php
7
8class StrFail {
9    public function __toString(): string {
10        throw new Error('create a leak');
11    }
12}
13
14$key = ["", new StrFail];
15try {
16    openssl_pkey_export_to_file($key, "doesnotmatter");
17} catch (Error $e) {
18    echo $e->getMessage(), "\n";
19}
20
21?>
22--EXPECT--
23create a leak
24