File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
src/Library/KeyManagement/KeyConverter Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 18
18
use function in_array ;
19
19
use function is_array ;
20
20
use function is_string ;
21
+ use const E_ERROR ;
22
+ use const E_PARSE ;
21
23
use const OPENSSL_KEYTYPE_EC ;
22
24
use const OPENSSL_KEYTYPE_RSA ;
23
25
use const OPENSSL_RAW_DATA ;
@@ -48,6 +50,7 @@ public static function loadKeyFromCertificate(string $certificate): array
48
50
throw new RuntimeException ('Please install the OpenSSL extension ' );
49
51
}
50
52
53
+ $ errorReporting = error_reporting (E_ERROR | E_PARSE );
51
54
try {
52
55
$ res = openssl_x509_read ($ certificate );
53
56
if ($ res === false ) {
@@ -56,6 +59,8 @@ public static function loadKeyFromCertificate(string $certificate): array
56
59
} catch (Throwable ) {
57
60
$ certificate = self ::convertDerToPem ($ certificate );
58
61
$ res = openssl_x509_read ($ certificate );
62
+ } finally {
63
+ error_reporting ($ errorReporting );
59
64
}
60
65
if ($ res === false ) {
61
66
throw new InvalidArgumentException ('Unable to load the certificate. ' );
You can’t perform that action at this time.
0 commit comments