1--TEST-- 2openssl_pkey_export_to_file object to string conversion 3--EXTENSIONS-- 4openssl 5--FILE-- 6<?php 7 8class Test { 9 public function __toString(): string { 10 return "file://" . __DIR__ . "/private_rsa_1024.key"; 11 } 12} 13 14$path = new Test; 15$key = [$path, ""]; 16@openssl_pkey_export_to_file($key, str_repeat("a", 10000), passphrase: ""); 17var_dump($key); 18 19?> 20--EXPECT-- 21array(2) { 22 [0]=> 23 object(Test)#1 (0) { 24 } 25 [1]=> 26 string(0) "" 27} 28